How to find directories that do not have a certain file
I'm having problems figuring out the process to find directories that DO NOT contain a certain file. I have a mp3 collection that all the album art is name "folder.jpg". Not all the albums have images. I need a way to find the albums/directories that do not contain "folder.jpg". I can find the ones that do contain "folder.jpg" with
Code:
find . -iname 'folder.jpg' -print0 | xargs -0 ls >> album_art Any suggestions as to how to go about this would be appreciated. My directory structure is like such: a-z/artist/album/folder.jpg |
Code:
find . '!' -iname 'folder.jpg' |
I don't think that you can do this with a single "find" command (find . ! -iname "folder.jpg" will find all files (and folders) not called folder.jpg).
To find all directories that do not contain this file, you could use a simple loop like: Code:
for dir in `find . -type d`; do |
hmm.. reading comprehension fail
Code:
find -type d '!' -exec test -e "{}/folder.jpg" ";" -print |
Thanks Robhogg, that gets me a lot closer.
Now I just need to list only the album directory and not its parent directory. I'm off to research and play with this a little more. |
Quote:
|
All times are GMT -5. The time now is 06:06 PM. |