从文件夹中删除文件 [英] delete file from folder
本文介绍了从文件夹中删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好:)
我在文件夹中有图像
并且我想更新数据库并删除旧图像
我该怎么办?
谢谢大家:)
hi all :)
I have images at a folder
and I want to update database and delete the old image
how can I do it ?
thank you all :)
推荐答案
问题是什么,System.IO.File.Delete
?此处: http://msdn.microsoft.com/en-us/library/system.io.file.delete.aspx [ ^ ].与存储文件名的数据库保持同步.
—SA
What''s the problem,System.IO.File.Delete
? Here: http://msdn.microsoft.com/en-us/library/system.io.file.delete.aspx[^]. Keep in sync with the database where you store the file names.
—SA
在其中查找文件,如果存在,则将其删除为:
Find the file in and if it exist then delete it as:
filename= AppDomain.CurrentDomain.BaseDirectory + "/images/Photos/" + file;
if (File.Exists(filename))
File.Delete(filename);
System.IO.File.Delete(filepath);
这篇关于从文件夹中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文