delete-file

Delete all files within a directory vb6

廉价感情. 提交于 2020-01-03 18:43:13
问题 I was wondering if anyone could help me with a vb6 function that would delete all files within a directory (excluding subdirectories). 回答1: One line, using the VB6 statement Kill Kill "c:\doomed_dir\*.*" The help topic says "In Microsoft Windows, Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files". As an aside - I prefer to avoid the Microsoft Scripting Runtime (including FileSystemObject). In my experience it's occasionally broken on

Reflecting methods to clear Android app cache

一世执手 提交于 2020-01-03 05:32:28
问题 I am trying to clear the app cache of other android apps besides my own. To do this, I am using reflection on the PackageManager class. However, whenever I initialize the method before I invoke it, it always ends up being null. private void initiateClearUserData() { // Invoke uninstall or clear user data based on sysPackage String thePackageName; PackageManager pm = speedy.this.getPackageManager(); List<ApplicationInfo> installedApps = pm.getInstalledApplications(0); ApplicationInfo ai;// =

Delete file on server

社会主义新天地 提交于 2020-01-03 04:59:27
问题 I have a file path in the format file://SERVERNAME/FOLDER$/FOLDER/image.jpg . I call System.IO.File.Delete(Server.MapPath(file://SERVERNAME/FOLDER$/FOLDER/image.jpg)) to delete the file, but i get the error file:/SERVERNAME/FOLDER$/FOLDER/image.jpg' is not a valid virtual path. I notice that a '/' is missing and I do not know why. How will I delete such file? I have tried converting my file path to file:////SERVERNAME//FOLDER$//FOLDER//image.jpg but this did not help. Same thing happens. If I

Search and then delete depending on whether files contain a string

旧街凉风 提交于 2020-01-02 05:06:19
问题 I'd like to search through multiple text files in a single directory for a string ('monkey'), if the string exists, then either, depending on what's easiest: rename the matching string - e.g. change monkey monkey1 and save then file and carry on searching/processing or Delete any file that has the matching string. Have searched but can't seem to find anything straightforward. 回答1: Modifying the contents of a text file is fairly complex using native Windows batch commands, so option 1) is not

Firebase Storage Allow Deleting Files

人走茶凉 提交于 2020-01-02 04:55:12
问题 I have the following rules for user post image uploads, however current rules don't allow file deletion. How can I modify the rules to allow user to delete his pictures? What property on request variable indicates that a request is DELETE ? match /{uid}/posts/{pid}/{imageName} { allow read; allow write: if (uid == request.auth.uid) && (( ((imageName == "pic.jpg") || (imageName == "pic.png") || (imageName == "pic.gif")) && (request.resource.size < 5 * 1024 * 1024) && (request.resource

Difference between unlink and rm on unix

可紊 提交于 2020-01-01 17:05:25
问题 Whats the real different between these two commands? Why is the system call to delete a file called unlink instead of delete ? 回答1: You need to understand a bit about the original Unix file system to understand this very important question. Unlike other operating systems of its era (late 60s, early 70s) Unix did not store the file name together with the actual directory information (of where the file was stored on the disks.) Instead, Unix created a separate " Inode table " to contain the

Windows batch file to delete .svn files and folders

被刻印的时光 ゝ 提交于 2019-12-31 08:07:09
问题 In order to delete all ".svn" files/folders/subfolders in "myfolder" I use this simple line in a batch file: FOR /R myfolder %%X IN (.svn) DO (RD /S /Q "%%X") This works, but if there are no ".svn" files/folders the batch file shows a warning saying: "The system cannot find the file specified." This warning is very noisy so I was wondering how to make it understand that if it doesn't find any ".svn" files/folders he must skip the RD command. Usually using wild cards would suffice , but in

How to securely delete files in java

我的未来我决定 提交于 2019-12-29 04:59:25
问题 How do I securely delete files in java? I tried the code at javafaq.nu, but the problem is you can't actually delete the file on windows once it has been mapped due to this bug. Then I tried just using sysinternals sdelete on windows, but you have to click a usage agreement the first time you use it which I want to avoid. 回答1: On a journaling filesystem like NTFS there is actually no way to securely erase a single file without wiping all the free space on the drive. The problem is that the

Linux delete file with size 0 [duplicate]

孤者浪人 提交于 2019-12-29 02:22:29
问题 This question already has answers here : How to delete many 0 byte files in linux? (10 answers) Closed 3 years ago . How do I delete a certain file in linux if its size is 0. I want to execute this in an crontab without any extra script. l filename.file | grep 5th-tab | not eq 0 | rm Something like this? 回答1: This will delete all the files in a directory (and below) that are size zero. find /tmp -size 0 -print0 |xargs -0 rm -- If you just want a particular file; if [ ! -s /tmp/foo ] ; then rm

Linux delete file with size 0 [duplicate]

倖福魔咒の 提交于 2019-12-29 02:22:08
问题 This question already has answers here : How to delete many 0 byte files in linux? (10 answers) Closed 3 years ago . How do I delete a certain file in linux if its size is 0. I want to execute this in an crontab without any extra script. l filename.file | grep 5th-tab | not eq 0 | rm Something like this? 回答1: This will delete all the files in a directory (and below) that are size zero. find /tmp -size 0 -print0 |xargs -0 rm -- If you just want a particular file; if [ ! -s /tmp/foo ] ; then rm