wp 删除独立存储空间文件(多级非空文件夹删除)
void DelFile(string unZipFilePath)//unZipFilePath第一次傳遞的是根目錄名
? ?? ???{
? ?? ?? ?? ?using (var store = IsolatedStorageFile.GetUserStoreForApplication())
? ?? ?? ?? ?{
? ?? ?? ?? ?? ? if (store.DirectoryExists(unZipFilePath))
? ?? ?? ?? ?? ? {
? ?? ?? ?? ?? ?? ???String[] dirNames = store.GetDirectoryNames(string.Concat(unZipFilePath, "\\*"));
? ?? ?? ?? ?? ?? ???String[] fileNames = store.GetFileNames(string.Concat(unZipFilePath, "\\*"));
? ?? ?? ?? ?? ?? ???if (fileNames.Length > 0)
? ?? ?? ?? ?? ?? ???{
? ?? ?? ?? ?? ?? ?? ?? ?for (int i = 0; i < fileNames.Length; i++)
? ?? ?? ?? ?? ?? ?? ?? ?{
? ?? ?? ?? ?? ?? ?? ?? ?? ? store.DeleteFile(string.Concat(unZipFilePath, "\\", fileNames[i]));
? ?? ?? ?? ?? ?? ?? ?? ?}
? ?? ?? ?? ?? ?? ???}
? ?? ?? ?? ?? ?? ???if (dirNames.Length == 0)
? ?? ?? ?? ?? ?? ???{
? ?? ?? ?? ?? ?? ?? ?? ?store.DeleteDirectory(unZipFilePath);
? ?? ?? ?? ?? ?? ?? ?? ?if (unZipFilePath.IndexOf("\\") != -1)
? ?? ?? ?? ?? ?? ?? ?? ?{
? ?? ?? ?? ?? ?? ?? ?? ?? ? unZipFilePath = unZipFilePath.Substring(0, unZipFilePath.LastIndexOf("\\"));
? ?? ?? ?? ?? ?? ?? ?? ?? ? DelFile(unZipFilePath);
? ?? ?? ?? ?? ?? ?? ?? ?}
? ?? ?? ?? ?? ?? ???}
? ?? ?? ?? ?? ?? ???if (dirNames.Length > 0)
? ?? ?? ?? ?? ?? ???{
? ?? ?? ?? ?? ?? ?? ?? ?for (int i = 0; i < dirNames.Length; i++)
? ?? ?? ?? ?? ?? ?? ?? ?{
? ?? ?? ?? ?? ?? ?? ?? ?? ? DelFile(string.Concat(unZipFilePath, "\\", dirNames[i]));
? ?? ?? ?? ?? ?? ?? ?? ?}
? ?? ?? ?? ?? ?? ???}
? ?? ?? ?? ?? ? }
? ?? ?? ?? ?}
? ?? ???}
轉載于:https://www.cnblogs.com/lutter/archive/2012/11/09/2763081.html
總結
以上是生活随笔為你收集整理的wp 删除独立存储空间文件(多级非空文件夹删除)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: “应为邮亭名棣华”上一句是什么
- 下一篇: 11月