Accidental Paste
March 20th, 2005
If you’re as stupid as I am… you may have made this mistake several times. Allow me to demonstrate my stupidity: I was copying a directory filled with some files (and in all honesty I am unsure if those files were fonts, conf files or whatever, although what I do remember is that the files had lots of varied extentions) and I copied the files to
/etc/
or something as hopelessly stupid as that.
So what you want to do is delete all the files you copied and pasted to the wrong place fast and easily. This example merely just does a checklist of the files you just copied from and then deletes the files if they’re from the source directory… in lamens: if unwanted file is the same as the one in the original place… delete it.
cd /file/from/dir; for file in *; do rm /etc/$file; done;
obviously you’ll have to toy with it to do things you may want … perhaps change the chown or whatever.