![]() |
| Image Source: http://systemcentercentral.com/Portals/0/VivoIndexItem/Index23742/WLW-RecursivelyDeleteReadOnlyDirectoriesSubd_F9F8-powershell2xa4_2.jpg |
Cleaning out some files, I realized I had a lot of unneeded files that were all the same extension. Unfortunately, they were scattered inside of a million folders. What I needed was a command that would go through each folder and delete those files, saving me the effort of doing that. Then, after that, get rid of any empty directories that might have been left behind.
find /home/mg/Desktop/books -iname “*.html” -exec rm ‘{}’ ‘;’
find -depth -type d -empty -exec rmdir {} \;
Windows user? Read this how to.
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 \;
Enter your email address:
Delivered by FeedBurner
Discover more from Another Think Coming
Subscribe to get the latest posts sent to your email.

