You are not logged in.
What I want to do is simply delete all the album art that manages to get download with some torrents. However I have a huge music collection...and to sort thrugh all the floders trying to delete the jpgs would simply take too long. So is there a command I can use in terminal to recursivley delete ONLY the jpg files in my music directory??
"The hardest thing is rendering a moment moving to fast to endure"
Offline
find . -name '*.jpg' -exec rm {} \;Should do it for you. If you want to ensure that only the right files are being deleted, just run
find . -name '*.jpg'That will list everything that would be removed.
man findfor more.
Offline
well the only problem with is...when I run the command to list the files that would be removed...it shows all my photos, icons etc...
"The hardest thing is rendering a moment moving to fast to endure"
Offline
So find on your music directory instead of '.' .
Offline
Two small additional suggestions:
- find has its own removal flag, so you could also do:
find /path/to/music -name '*.jpg' -delete- find also has a very good man page ![]()
Offline
Ok...unless Im doing something wrong...which is very possible. This isnt doing what I want it to do. I dont even know if you CAN do what I want. I want to delete every jpg image in my music directory with one command. A buddy told me this can be done with wildcards but he doesnt know how. So rather than going through each album in my music directory, Im wanting to know if there is a command to delete only jpg images from my entire music directory...without it recursing into my home in turn wiping out all my photos too. This may be what you are telling me and Im making a mistake somewhere on my end. But Im just using a test folder with files I dont really care about and can be replaced, and so far either the entire directory is deleted or nothing at all is deleted. For instance...
find /home/nate/test -Disc_4 '*.jpg' -delete...gives me this
find: invalid predicate `-Disc 4'
and the entire directory /home/nate/test is deleted
find /home/nate/test '*.jpg' -delete returns the '*.jpg': no such file or directory...which I thought it would do but I tried it anyway.
So I'm wondering...Did I still use the command wrong? Or is this command not going to do what Im trying to do? If so is there a command that will?
Thank you for all your help
"The hardest thing is rendering a moment moving to fast to endure"
Offline
I think what you are looking for is:
find /home/nate/test/Disc_4 -name '*.jpg'Offline
Or in more general terms, you could try using the command as it was given i.e. with the -name flag. ![]()
Seriously though
-
this
find /home/nate/test -Disc_4 '*.jpg' -deletedoesn't work because there's a space and '-' between 'test' and 'Disc_4', so find attempts to make some sense of 'Disc_4' as a flag, which obviously doesn't work out.
The reason I suggested reading the man page was that I thought you might like to work out the right command for yourself, rather than rely on suggestions here (notwithstanding the IMO overall high quality of advice given). If you would prefer not to do that, the various commands given above will work, IF you use them as given, AND insert the full path to your music directory.
Last edited by tomk (2007-06-23 21:51:13)
Offline
Id have to agree that the advice is of very high quality...thats what keeps me comin back hehe. Thanks that worked...I figured it must have been a typo in the command. It wasnt exactly what I was looking for but Ill check the man pages and see if i can refine it alittle. Thanks again for all the help everyone
"The hardest thing is rendering a moment moving to fast to endure"
Offline