Deleting backup files in my system.
Hey, I dont know how to do it... I really dont like that my system start populating of:
filex.sss~ cuacua.sxcv~ I have tryied to do a simple thing Code:
ls -a -p --recursive| grep "~" And wich is the correct way of do some like: Code:
ls -a -p --recursive| grep "~" | rm |
You could do something like...
Code:
find -name "*~" | xargs rm |
Thx for the tip, I have finded a problem, it delete the files that dosent contain spaces, so for example:
Code:
EDIT: Like I see now, xargs pass arguments... I guess that is passing questions 1.txt... I have tryied enter the command manually, and I see that for pass the space, there should be an backslash "\" before the space char, some like instead of pass questions 1.txt, pass questions\ 1.txt, now is that possible????? |
Hmmm...
Code:
find -name "*~" -printf "\"%p\"\n" | xargs rm EDIT: Ah... okay... make sure the -printf option is LAST! (... if it isn't, it will delete all files recursively) |
How about:
Code:
find -type f -name "*~" -exec rm "{}" \; Cheers, Tink |
Hi there, thx for the suguestionts, they work like a charm.
I have now tryied delete a specific dirs and its contents recursively, for example CVS folders in a project. Tought I havent finded a good way of do it, also dont know if will work if the files or the directoires contain spaces.... And is a thing of 2 +1 steps.... Step 1) Write this (for delete CVS folders and contents): Code:
find -type d -name "CVS" -printf "\"%p\"\n" | xargs ls | xargs Code:
./CVS: Entries Repository Root ./etc/CVS: Entries Repository Root ./etc/interface/CVS: Entries Repository Root Step 2) copy the output (dont a nice way.. but work... :S) Step 3) run deleter [paste here the output] OR in this case #deleter ./CVS: Entries Repository Root ./etc/CVS: Entries Repository Root ./etc/interface/CVS: Entries Repository Root Where deleter is the name of the program output of the following code.... Code:
#include <stdio.h> But at less have worked OK here... |
find -type d -name "CVS" -exec rm -rf "{}" \;
Cheers, Tink |
All times are GMT -5. The time now is 10:31 AM. |