You are not logged in.
I'm wondering how to go about recursively deleting all .ogg files from an entire directory structure.
Would something like this do it?
find /mount/point -name '*.ogg' -type f -exec rm '{}' \;
Last edited by graysky (2009-06-07 17:08:18)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
You can create a folder and test it, before running it seriously.
I've done it more than once like this
rm -f `find /mount/point -name \*.ogg`
Offline
Why not just
find /path/ -name *ogg -exec rm {} \;
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
find . -name "*.ogg" -delete
Edit: if you use bash4 or zsh
for f in **/*.ogg; do rm "$f"; done
Edit: Use at your own risk, test before you try it on real data.
Last edited by Mr.Elendig (2009-06-07 13:48:27)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Why not just
find /path/ -name *ogg -exec rm {} \;
damn. is there an o'reilly book about 'find' yet? there should be. i read the man page not too long ago and realized that it's a whole damned file-manager unto itself.
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
B wrote:Why not just
find /path/ -name *ogg -exec rm {} \;
damn. is there an o'reilly book about 'find' yet? there should be. i read the man page not too long ago and realized that it's a whole damned file-manager unto itself.
`man find` and search for '-delete'
Last edited by Mr.Elendig (2009-06-07 15:36:18)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
With zsh and probably bash 4:
rm /mount_point/**/*.ogg
Last edited by lucke (2009-06-07 15:47:06)
Offline
Thanks for the replies, all. My original line did work. Maybe I need to have a look at bash4 since the code is a bit leaner, but I am no bash 3 expert by any means
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
With the GNU find you can just use -delete
Offline