removing one file type from a large file collection(solved)

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

removing one file type from a large file collection(solved)

Post by psyodin »

hello. i have large music collection and would like to remove all the jpeg files (ie cover, file, etc) that i have accumulated over time. so my plan would be to search my music file for any jpegs and delete them. i assume this is possible however the HOW is eluding me. i have tried the tracker search tool and the search tool in the file management program but either they dont work as i assume they should or im not using them properly. any help would be appreciated.


linux mint darnya with gnome desktop

good day
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Fred

Re: removing one file type from a large file collection

Post by Fred »

psyodin,

You can do this from the command line pretty easily. Open a terminal and change the directory to the one that holds your jpeg files.

cd /home/fred/Music

To remove all the jpeg files in that directory type:

rm -v *.jpeg

They will be gone. You can not recover them once you press enter. :-)

This of course can be used to delete other file types too, by changing the *.jpeg to *.mp3 as an example.

Fred
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

Re: removing one file type from a large file collection

Post by psyodin »

thank you for the help

when i tried that i get:

rm: cannot remove `*.jpeg': No such file or directory


now i have folders inside myputer@myputer:~$ cd /home/myputer/Music

for example /home/myputer/Music/A-I/Alice in Chains/Dirt/Folder.jpg

perhaps that is the problem but im hoping to avoid opening each folder or change directory to each folder to delete the jpeg files
Fred

Re: removing one file type from a large file collection

Post by Fred »

psyodin,

Sorry I went to dinner.

Didn't realize your files weren't in one directory. try this in a terminal:

find . -name \*.jpeg | xargs rm

Fred
Fred

Re: removing one file type from a large file collection

Post by Fred »

Lysias,

This is workable too. The only thing about your approach is that the rm command is limited in the amount of data it can handle at one time. I got the impression he had a lot to delete. Don't know if it would be enough to cause an error or not.

Using a pipe and the xargs command breaks it up into multiple small chunks that rm may find easier to deal with.

Not throwing rocks. You idea will work just fine as long as he doesn't have too much data to deal with. :-)

Fred
Fred

Re: removing one file type from a large file collection

Post by Fred »

Lysias,

No need to be sorry sir. Your suggestion was a good one. I just had no idea how much data he was playing with, that's why I did it like that. :-)

That's whats nice about linux. There are always multiple ways of getting things done.

Please feel free to chime in on my instructions if you see something I am doing wrong, or a better way. It won't offend me, I am always willing to learn a better way. :-)

Fred
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

Re: removing one file type from a large file collection

Post by psyodin »

when i try find . -name \*.jpeg | xargs rm
i get rm: missing operand
Try `rm --help' for more information.

i looked at help and put find . -name \*.jpeg | xargs rm -- *.jpeg foo

result rm: cannot remove `*.jpeg': No such file or directory


and find . -name \*.jpeg | xargs rm -v
result rm: missing operand

and with -f same result

when i try find . -type f -name "*.jpeg" -exec rm -f {} \;

result is nothing as far as can tell...files still there

i did try both under root and normal terminals and tried .jpeg and .jpg in the command lines

i very much appreciate the help proved thusfar. much obliged. i think the solutions provided thusfar are close.

good day
Last edited by psyodin on Mon May 12, 2008 1:47 am, edited 1 time in total.
Fred

Re: removing one file type from a large file collection

Post by Fred »

psyodin,

I wouldn't think you would need it but put this in:

find . -name \*.jpeg | xargs rm *.jpeg

Fred
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

Re: removing one file type from a large file collection

Post by psyodin »

i made a small temp file on my desktop called temp that has subfolders,mp3's and jpg's to try all this out on just in case

myputer@myputer:~$ cd /home/level5ive/Desktop/temp
myputer@myputer:~/Desktop/temp$ find . -name \*.jpeg | xargs rm *.jpeg

rm: cannot remove `*.jpeg': No such file or directory



myputer@myputer:~$ cd /home/level5ive/Desktop/temp
myputer@myputer:~/Desktop/temp$ find . -name \*.jpg | xargs rm *.jpg

rm: cannot remove `*.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/Fireflies/AlbumArtSmall.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/Fireflies/AlbumArt_{CF99805B-E9CE-440E-8F6A-E3187FD0541F}_Large.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/Fireflies/Folder.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/Fireflies/AlbumArt_{CF99805B-E9CE-440E-8F6A-E3187FD0541F}_Small.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/AlbumArtSmall.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/AlbumArt_{9E97E25A-3B52-4C5A-AA63-7BFD552F454D}_Small.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/AlbumArt_{9E97E25A-3B52-4C5A-AA63-7BFD552F454D}_Large.jpg': No such file or directory
rm: cannot remove `./Faith': No such file or directory
rm: cannot remove `Hill/Folder.jpg': No such file or directory
rm: cannot remove `./Celtic': No such file or directory
rm: cannot remove `Woman/AlbumArt_{5C069418-EE88-46F0-8819-1F3042732D0C}_Large.jpg': No such file or directory
rm: cannot remove `./Celtic': No such file or directory
rm: cannot remove `Woman/AlbumArtSmall.jpg': No such file or directory
rm: cannot remove `./Celtic': No such file or directory
rm: cannot remove `Woman/Folder.jpg': No such file or directory
rm: cannot remove `./Celtic': No such file or directory
rm: cannot remove `Woman/AlbumArt_{5C069418-EE88-46F0-8819-1F3042732D0C}_Small.jpg': No such file or directory
rm: cannot remove `./Dreamworld-': No such file or directory
rm: cannot remove `Essential': No such file or directory
rm: cannot remove `Late': No such file or directory
rm: cannot remove `Night': No such file or directory
rm: cannot remove `Listening/AlbumArtSmall.jpg': No such file or directory
rm: cannot remove `./Dreamworld-': No such file or directory
rm: cannot remove `Essential': No such file or directory
rm: cannot remove `Late': No such file or directory
rm: cannot remove `Night': No such file or directory
rm: cannot remove `Listening/AlbumArt_{753CEB90-141E-42BE-AE6B-B545B970C483}_Large.jpg': No such file or directory
rm: cannot remove `./Dreamworld-': No such file or directory
rm: cannot remove `Essential': No such file or directory
rm: cannot remove `Late': No such file or directory
rm: cannot remove `Night': No such file or directory
rm: cannot remove `Listening/Folder.jpg': No such file or directory
rm: cannot remove `./Dreamworld-': No such file or directory
rm: cannot remove `Essential': No such file or directory
rm: cannot remove `Late': No such file or directory
rm: cannot remove `Night': No such file or directory
rm: cannot remove `Listening/AlbumArt_{753CEB90-141E-42BE-AE6B-B545B970C483}_Small.jpg': No such file or directory
rm: cannot remove `./Eric': No such file or directory
rm: cannot remove `Clapton/Journeyman/AlbumArtSmall.jpg': No such file or directory
rm: cannot remove `./Eric': No such file or directory
rm: cannot remove `Clapton/Journeyman/AlbumArt_{4C0F28EF-00DA-4AAC-B7E4-78D17C546ACC}_Small.jpg': No such file or directory



heh. its all good i can go thru manually delete things.....my only other option is too transfer to an external HD and use a puter with XP on it then search and delete that way. thanks again
Fred

Re: removing one file type from a large file collection

Post by Fred »

psyodin

find . -name \*.jpeg | xargs -0 rm

see if this does it.. you may need sudo.

sudo find . -name \*.jpeg | xargs -0 rm
Fred

Re: removing one file type from a large file collection

Post by Fred »

looks like they are .jpg not jpeg
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

Re: removing one file type from a large file collection

Post by psyodin »

ok got it to work i used

find . -type f -name "*.jpg" -exec rm -f {} \;

having changed jpeg to jpg

thanks all for the help and its prolly my error(s) that made other options not work

muchas gracias amigos


edit: ill try that other way too and see what happens

thanks again
Last edited by psyodin on Mon May 12, 2008 2:24 am, edited 1 time in total.
Fred

Re: removing one file type from a large file collection

Post by Fred »

psyodin,

Well I did have a mistake in my first post. it should have been:

find . -name \*.jpg | xargs -0 rm

All is well that ends well though. :-)

Fred
User avatar
psyodin
Level 1
Level 1
Posts: 8
Joined: Tue Nov 13, 2007 12:16 am

Re: removing one file type from a large file collection

Post by psyodin »

ahh

well indeed it did end well

your very kind

good evening sir :)
Locked

Return to “Beginner Questions”