标签: delete-file

Android,删除我的数据目录中的文件?

我的应用程序存储了一些在应用程序的数据目录中运行所需的文件

/data/data/com.example.myapp/files/filehere.file
Run Code Online (Sandbox Code Playgroud)

当我的应用程序从市场更新时,重要的是我清除数据目录中的文件,并将它们更新为刚刚下载的新软件包中的最新文件.

我的问题是,我如何以编程方式删除相关目录中的文件?

或者,是否存在可以存储文件的备用目录,该目录在我的应用程序版本的生命周期内是持久的,但是一旦安装了更新,它将被清除?

android version delete-file

3
推荐指数
1
解决办法
1万
查看次数

创建批处理文件以删除特定文件

起初,我知道这个问题可能存在,但是第一眼我找不到我想要的答案.

我在创建批处理文件时遇到问题,该批处理文件应删除多个文件,并将其特定文件格式作为参数给出.应将这些文件所在的文件夹定义为第一个参数.只读,隐藏和系统文件也应该删除.

到目前为止,我有这样的事情:

CD %1
IF EXIST *.%2 DEL *.%2  /F /A:H /A:S
Run Code Online (Sandbox Code Playgroud)

但这不应该有它应该有的结果......有人可以帮助我吗?

batch-file delete-file

3
推荐指数
1
解决办法
2万
查看次数

在android中删除sdcard中的文件

我正在制作一个应用程序,我必须在sdcard中删除最近添加的mp3文件.保存歌曲的格式为:

Songhello_17_26.amr
Run Code Online (Sandbox Code Playgroud)

其中17_26是添加歌曲的时间.谁能帮助我如何删除sdcard中最近添加的文件.我的意思是说我要删除时间意味着最新添加的文件应该被删除.任何帮助将不胜感激.

android file sd-card delete-file

3
推荐指数
1
解决办法
7669
查看次数

nftw线程安全

在C/C++中是否有任何线程安全的nftw()实现?在文档中说

"nftw()函数不一定是线程安全的."

我将使用nftw作为递归删除函数来遍历多线程应用程序中的目录结构.

c recursion thread-safety delete-file nftw

3
推荐指数
1
解决办法
830
查看次数

如何使用PHP从目录中删除除一个文件以外的所有文件?

我有几个目录,其中包含一些文件:

/test1/123.jpg
/test1/124.jpg
/test1/125.jpg
/test2/123.jpg
/test2/124.jpg
Run Code Online (Sandbox Code Playgroud)

我要删除所有除了/test1/124.jpg or /test2/124.jpg

我知道目录名称和文件名.有没有办法在Linux环境中使用php而且可能unlink

php unlink delete-file removeall

3
推荐指数
2
解决办法
6167
查看次数

使用批处理脚本查找和删除驱动器上每个文件夹中的desktop.ini文件

我想使用Windows批处理文件查找并删除网络驱动器H:上的每个desktop.ini和Recycle Bin.BIN文件.我目前有这个:

@echo About to delete all desktop.ini and Recycle Bin.BIN files from H:, press Ctrl+C to cancel or Enter to continue.
@pause
@H:
@for /f "usebackq" %%i in (`dir /s /b /x /A:H ^| find "desktop.ini"`) do del /A:H "%%i"
@for /f "usebackq" %%i in (`dir /s /b /x /A:RH ^| find "Recycle Bin.BIN"`) do del /A:RH "%%i"
@echo Deleting complete, press any key to exit.
@pause
Run Code Online (Sandbox Code Playgroud)

哪个适用于子文件夹中的任何文件,其名称中的空格失败并显示"无法找到文件"错误.任何建议如何解决?

windows hidden batch-file delete-file

3
推荐指数
3
解决办法
2万
查看次数

Delete all in folder except the filename in list

I have a folder, and a list (which contain file names). I want the program delete files except the file which are listed. C#

I hope it is possible.

Now used code:

It delete only ONE file.

        string folder = Directory.GetCurrentDirectory();
        string thisNOdelete = "example.exe";
        string[] list = Directory.GetFiles(@folder);//
        foreach (string file in list)
        {

            if (file.ToUpper().Contains(thisNOdelete.ToUpper()))
            {
                    //if found this do nothing

            }
            else
            {

               File.Delete(file);
            }
        }
Run Code Online (Sandbox Code Playgroud)

c# directory getfiles delete-file

3
推荐指数
1
解决办法
1298
查看次数

如何删除目录以外的所有文件?

我没有成功搜索删除工作目录中除了子目录之外的所有文件的解决方案.

我找到了一种方法来删除所有目录中的所有文件,但我正在寻找一种方法来删除我所在的同一"级别"上的文件.

directory bash subdirectory delete-file

3
推荐指数
2
解决办法
3112
查看次数

iOS:使用Swift2删除.DocumentDirectory中的文件

我有一个项目,我正在将数据保存为PDF.这个代码是:

// Save PDF Data

let recipeItemName = nameTextField.text

let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]

pdfData.writeToFile("\(documentsPath)/\(recipeFileName).pdf", atomically: true)
Run Code Online (Sandbox Code Playgroud)

我能够UITableView在另一个文件中单独查看文件ViewController.当用户滑动时,UITableViewCell我希望它也从中删除该项目.DocumentDirectory.我的UITableView删除代码是:

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {

    if editingStyle == .Delete {

        // Delete the row from the data source

        savedPDFFiles.removeAtIndex(indexPath.row)

        // Delete actual row

        tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)


        // Deletion code for deleting from .DocumentDirectory here???


    } else if editingStyle == .Insert {

        // Create a new instance …
Run Code Online (Sandbox Code Playgroud)

uitableview delete-file ios swift2

3
推荐指数
1
解决办法
1126
查看次数

递归删除 desktop.ini 文件

我正在尝试删除desktop.ini给定目录中的所有文件;即Documents\Gio。我试着del /S desktop.inidel /S *.ini在CMD(管理模式),get-childitem .\ -include desktop.ini -recurse | foreach ($_) {remove-item $_.fullname}get-childitem .\ -include *.ini -recurse | foreach ($_) {remove-item $_.fullname}在PowerShell中(也管理员)。两者都没有工作。我该怎么办?

这些desktop.ini文件包含以下内容:

[.ShellClassInfo]
InfoTip=This folder is shared online.
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
IconIndex=12
Run Code Online (Sandbox Code Playgroud)

我从我的 Google Drive 文件夹中移动了目录,但所有文件夹上仍然有共享图标。我试图将目录及其所有子目录和文件的所有权更改为不同的帐户。我尝试使用 Google Drive 执行此操作,但只有根目录更改了所有权;我无法删除其中的任何文件或目录。

powershell cmd delete-file

3
推荐指数
1
解决办法
5752
查看次数