delete-file

How to find latest modified files and delete them with SHELL code

ε祈祈猫儿з 提交于 2019-12-11 03:01:54
问题 I need some help with a shell code. Now I have this code: find $dirname -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 | cut -c 35- This code finds duplicated files (with same content) in a given directory. What I need to do is to update it - find out latest (by date) modified file (from duplicated files list), print that file name and also give opportunity to delete that file in terminal. 回答1: Doing this in pure bash is a tad awkward, it would be a lot easier to

How do I delete a .txt file with TSQL, without using xp_cmdshell

自古美人都是妖i 提交于 2019-12-11 02:14:06
问题 I am trying to use TSQL to delete a .txt file at the end of a process. My restriction is that I cannot use xp_cmdshell. I had tried using the undocumented xp_delete_file but from what I can find it will only delete SQLServer native .ldf or .bak files. Is there another approach that can be used? I am running in SQL server 2008 R2. 回答1: Use SQL Server Agent CmdExec job step? This can run "del"... http://msdn.microsoft.com/en-us/library/ms190264.aspx In step 8 you'd have del c:\importpath

SVN merge trunk into branch deleting files

人盡茶涼 提交于 2019-12-10 23:07:41
问题 I am trying to do something seemingly simple, yet having problems. Basically, I have an svn repo, it has a trunk and a branch which was created from revision 122. I added a file (src/utils/foo.py) to the branch, committed it as revision 128, all good. However, there have been several commits (namely (123,124,125,126,127) in to the trunk that I'd like in my branch. So I do something like: $ svn merge -r122:127 ^/projects/my_project/trunk/src/utils . --- Merging r123 through r127 into '.': D

Delete function not working

笑着哭i 提交于 2019-12-10 14:22:02
问题 I am developing an app which has a splash screen that downloads a couple of files, before the files start to download I want to check whether the files already exist or not, and if they exist I want to delete them. The code shown below contains the right file paths and the function to check if the file exists seems to work as the read out in Logcat states "file deleted". However when I check on the phone itself I see that whenever I launch the app 2 more files are added to the folder with the

Counter inside a recursive function

て烟熏妆下的殇ゞ 提交于 2019-12-10 11:40:50
问题 I need to count the number of files deleted in this recursive function. Since it's recursive I cannot use if statements, and C# does not support global variables. Any alternatives? static void DirSearch(string path) { try { foreach (string dirPath in Directory.GetDirectories(path)) { foreach (string filePath in Directory.GetFiles(dirPath)) { string filename = Path.GetFileName(filePath); if (filename.Equals("desktop.txt")) { File.Delete(filePath); //count++ } Console.WriteLine(filePath); //

Ignore (no commit) locally deleted files tracked by Git

情到浓时终转凉″ 提交于 2019-12-10 09:40:27
问题 I need delete file from file system which is tracked by Git repository and I want leave that file in Git repository unchanged (no commit to repo). It's easy for locally modified file where I'm using assume-unchanged option of update index and it works just fine. I need same behavior for deleted files. I've tried this with no success: git update-index --assume-unchanged <file> Add file to .git/info/exclude 回答1: If you run git update-index --assume-unchanged <file> before you delete the file

Performance of deleting folder with lots of files on iOS

故事扮演 提交于 2019-12-10 09:27:28
问题 Say I've got a folder in my iOS app's data directory with several thousand small files in it. Deleting this folder (via [NSFileManager removeItemAtPath] ) takes a nontrivial amount of time. But on OS X, deleting a folder with the same contents is very fast. It seems to simply unlink the folder from the filesystem. So why does iOS take so long? What is the difference? Edit: On an iPad 3, deleting 3 folders with 5,000 to 9,000 files each takes about 35 seconds. On the simulator running on an

Getting only once permission for sdcard window on Lollipop and above version

大城市里の小女人 提交于 2019-12-09 19:57:26
问题 Hello I am deleting some items from SD card. And in lollipop first time i ask for permission and user grant permission, but now i don't want to ask every time for permission. Its very irritating and many of guys they afraid from this behavior. How can i save my permission i.e. next time i don't need to pass that Intent again and again Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); Thank you 回答1: I give you some code to example. Remember that u need check permission on Android 6

What's the “proper” way to delete files from a ClearCase snapshot?

时光总嘲笑我的痴心妄想 提交于 2019-12-09 15:28:41
问题 When I delete a file from my snapshot view, the next time I look at the snapshot in ClearCase Explorer, it shows the "??" checked-out-but-removed icon. When I run "Find Modified Files" on the snapshot, the deleted files aren't shown. Running "Update View" on the snapshot causes ClearCase to re-copy the missing files back into my view. What I want to happen is this: when I delete a file from my snapshot, and do an update, the file should be deleted from the view, just as if I had deleted it

PHP + FTP delete files in folder

倾然丶 夕夏残阳落幕 提交于 2019-12-09 13:15:26
问题 I just wrote a PHP Script which should connect to FTP and delete all files in a special folder. It looks like this, but I have no clue what command I need to delete all files in the folder logs. Any idea? <?php // set up the settings $ftp_server = 'something.net'; $ftpuser = 'username'; $ftppass = 'pass'; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftpuser, $ftppass); // delete all files in the folder