delete-file

How to make .BAT file delete it self after completion?

自作多情 提交于 2019-11-27 00:57:44
How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself. Merlyn Morgan-Graham @ECHO OFF SETLOCAL SET someOtherProgram=SomeOtherProgram.exe TASKKILL /IM "%someOtherProgram%" ECHO "This script will now self-destruct. Please ignore the next error message" DEL "%~f0" Note that the DEL line better be the last thing you intend to execute inside the batch file, otherwise you're out of luck :) This will print out an ugly error message, but it is benign, and the code is slightly less confusing this way. If you

How to make a batch file delete itself?

做~自己de王妃 提交于 2019-11-27 00:42:14
Is it possible to make a batch file delete its self? I have tried to make it execute another file to delete it but this did not work does any one know how I could do it. The batch file I am using is elevated. My OS is windows 7 32 bit. npocmaka's answer works, but it generates the following error message: " The batch file cannot be found. " This isn't a problem if the console window closes when the script terminates, as the message will flash by so fast, no one will see it. But it is very undesirable if the console remains open after the script terminates. The trick to deleting the file

Undo delete in GIT

亡梦爱人 提交于 2019-11-27 00:33:13
问题 I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using git rm -r Then I made another git commit (C). A-B-C ↑ master Is there any way to undelete the files but keep the changes I had in my first commit? (C) I'd rather do not go back to (B). I tried git reset --soft head^, so then the git status lists files I deleted, then I did git checkout, but still no luck. I don't even know

Delete files or folder recursively on Windows CMD

て烟熏妆下的殇ゞ 提交于 2019-11-27 00:04:44
问题 How do I delete files or folders recursively on Windows from the command line? I have found this solution where path we drive on the command line and run this command. I have given an example with a .svn file extension folder: for /r %R in (.svn) do if exist %R (rd /s /q "%R") 回答1: Please execute the following steps: Open the command prompt Change directory to the required path Give the following command del /S *.svn 回答2: The other answers didn't work for me, but this did: del /s /q *.svn

Can I delete data from iOS DeviceSupport?

浪尽此生 提交于 2019-11-26 23:44:25
问题 After going through and cleaning my disk with old things that I didn't need anymore, I came across the iOS DeviceSupport folder in ~/User/Library/Developer/Xcode which was taking nearly 20 GB. A similar question has been asked before, but since then many things have changed and I would like an up-to-date answer. As long as I have the version I use for testing, can I delete the older/unused versions without breaking anything? 回答1: The ~/Library/Developer/Xcode/iOS DeviceSupport folder is

Automatically Delete Files/Folders

旧街凉风 提交于 2019-11-26 18:51:36
Is there any way to automatically delete all files or folders with few R command lines? I am aware of the unlink() or file.remove() functions, but for those you need to define a character vector with exactly all the names of the files you want to delete. I am looking more for something that lists all the files or folders within a specific path (e.g. 'C:/Temp') and then delete all files with a certain name (regardless of its extension). Any help is very much appreciated! joran Maybe you're just looking for a combination of file.remove and list.files ? Maybe something like: do.call(file.remove,

How to delete files with a Python script from a FTP server which are older than 7 days?

安稳与你 提交于 2019-11-26 18:28:49
问题 I would like to write a Python script which allows me to delete files from a FTP Server after they have reached a certain age. I prepared the scipt below but it throws the error message: WindowsError: [Error 3] The system cannot find the path specified: '/test123/*.*' Do someone have an idea how to resolve this issue? Thank you in advance! import os, time from ftplib import FTP ftp = FTP('127.0.0.1') print "Automated FTP Maintainance" print 'Logging in.' ftp.login('admin', 'admin') # This is

php script to delete files older than 24 hrs, deletes all files

纵然是瞬间 提交于 2019-11-26 15:59:08
问题 I wrote this php script to delete old files older than 24 hrs, but it deleted all the files including newer ones: <?php $path = 'ftmp/'; if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ((time()-filectime($path.$file)) < 86400) { if (preg_match('/\.pdf$/i', $file)) { unlink($path.$file); } } } } ?> 回答1: (time()-filectime($path.$file)) < 86400 If the current time and file's changed time are within 86400 seconds of each other, then... if (preg_match('/\.pdf$/i',

How to remove a directory from git repository?

廉价感情. 提交于 2019-11-26 10:55:57
I have 2 directories on my GitHub repository. I'd like to delete one of them. How could I do that without deleting and re-creating entire repository? karmakaze Remove directory from git and local You could checkout 'master' with both directories; git rm -r one-of-the-directories git commit -m "Remove duplicated directory" git push origin <your-git-branch> (typically 'master', but not always) Remove directory from git but NOT local As mentioned in the comments, what you usually want to do is remove this directory from git but not delete it entirely from the filesystem (local) In that case use:

Delete file from zipfile with the ZipFile Module

自作多情 提交于 2019-11-26 09:33:04
问题 The only way I came up for deleting a file from a zipfile was to create a temporary zipfile without the file to be deleted and then rename it to the original filename. In python 2.4 the ZipInfo class had an attribute file_offset , so it was possible to create a second zip file and copy the data to other file without decompress/recompressing. This file_offset is missing in python 2.6, so is there another option than creating another zipfile by uncompressing every file and then recompressing it