How to use find and remove folders and files
Hello,
So I copied my music to a hard drive, I formatted my PC and copied it back. Though it was unsuccesul, there were some zero byte files that were created. I manage to delete them but not the artwork. So....basically I have many folders with just artwork that I want to delete... my question? Can you please provide me a command to find folders under a an specific path where there is no *.mp3 files and delete them at the same time? Also, how can I create a file with the names of thes folders? I hope you can help me! |
UPDATED
Put this code in a file and make it executable. (chmod a+x this_script.sh) This will find all the folders within the location it's saved & run from, and print the names of the folders that do not contain mp3 files. I've commented out the line that will delete the folders. If the list you get from this suits your needs, remove the "#" from line 4 and run it again. Be careful whenever you use rm. Code:
#!/bin/bash |
All times are GMT -5. The time now is 01:35 PM. |