![]() |
| Image Source: http://systemcentercentral.com/Portals/0/VivoIndexItem/Index23742/WLW-RecursivelyDeleteReadOnlyDirectoriesSubd_F9F8-powershell2xa4_2.jpg |
Two commands that can be given at the command line in UbuntuLinux (or Peppermint Linux which is what I was using) work...check further down in this post for how to on other platforms:
To recursively delete files with a particular filename extension:
find /home/mg/Desktop/books -iname "*.html" -exec rm '{}' ';'
In the command above, simply replace HTML with the filename extension you want to get rid of...could be XLS, ODF, PDF, MP3, MOV, whatever.
To delete empty directories, I used this command:
find -depth -type d -empty -exec rmdir {} \;
Both worked great and my hard drive is now free of unwanted files and directories. By the way, these commands run FAST. You blink and it's done. So, be careful.
Update: Interested in copying selected files from directories into one directory on GNU/Linux? Use this command:
find /home/mg/Desktop/books -iname "*.html" -exec cp {} /home/mg/Desktop/html \;If you want to move selected files, just use this command:
find /home/mg/Desktop/books -iname "*.html" -exec mv {} /home/mg/Desktop/html \;
Get Blog Updates via Email!
Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure


0 comments:
Post a Comment