![]() |
linux commands question
My mate gave me a lot of music the other day. But about half is DRMed and thus unplayable.
I need to know how to remove all of a certain file type from a folder and its sub folders. I've only been using linux (maemo 5 and ubuntu 9.04/10.04) for a year or so, i thought using (as root): Code:
rm -R *.m4p Ive managed to find all files with said extension by using(as root): Code:
find | grep m4p I've tried(also as root): Code:
find | grep m4p | rm Its just my lack of knowledge on how the pipe system works EDIT: The directory is /home/user/MyDocs/.sounds/Music there are sub directories per artist then album e.g. /home/user/MyDocs/.sounds/Music/Andrew WK/Close Calls With Brick Walls/Track1.m4p Any help appreciated. Cheers. |
Re: linux commands question
My usage pattern for recursively removing would be
Code:
rm -rf *.m4p |
Re: linux commands question
Little command here:
sza=$(ls | grep m4p); rm $sza should suffice. |
Re: linux commands question
Thanks to both michaaa62 & Reffyyyy for swift replies!
however running as root: Code:
rm -rf *.m4p also: Code:
sza=$(ls | grep m4p); rm $sza Code:
Usage rm [OPTION] ... [FILE] ... |
Re: linux commands question
Try one of the following:
Code:
rm `find . -name "*.mp4"` |
Re: linux commands question
You should be able to use the backtick operator to pass the output of find to rm, as so:
Code:
rm `find | grep m4p` Actually, I'm kind of surprised that that find command works for you; I thought you'd at least have to specify the path to look for files. I usually give find a command something like this: Code:
find . -name "*.m4p" Code:
find .sounds/Music -name "*.m4p" Code:
rm `find .sounds/Music -name "*.m4p"` |
Re: linux commands question
Were you in the folder when you ran the command?
If not: sza=$(ls -R | grep m4p); rm $sza to delete them all recursively. Works every time for me. EDIT: I spoke too soon. It appears that ls won't display the full path when recursive is switched on. |
Re: linux commands question
I like this one more:
sz+$(find . -name \*.m4p); rm $sz Tested this one a few times. If it doesn't work, you can have my shoes. Forgive my failures, I had no sleep last night. |
Re: linux commands question
Thanks to the thread, this can help me in Mac too.
|
Re: linux commands question
Thanks for all replies, however nothing is working
All commands do something similar to this I'm now at home so using SSH instead of tiny little keys :). using a single file at the moment, this is the path: Code:
./Neneh Cherry, Speech & Speech & Neneh Cherry/1 Giant Leap/Braided Hair.m4p Code:
Nokia-N900:/home/user/MyDocs/.sounds/Music# sz=$(find | grep Braided); rm $sz Code:
rm: cannot remove './Neneh': No such file or directory |
All times are GMT. The time now is 06:49. |
vBulletin® Version 3.8.8