terminal question (I think it has to do with grep)
Hello
If I want to delete all the other files then *.avi I can do this Code:
mkdir temp but... if there another option? i think there's something with grep or ugrep.. can u help me out to find another thing? thanks! |
Well, I use zsh, so I'd just do
Code:
rm *~*.avi How about this: Code:
rm $(find . -not -name "*.avi") |
With grep you could do this:
Code:
rm `ls .|grep -v avi$` @ioerror: Maybe a selection on files would be nice to add to your suggestion (to not delete directories) (although rm finds this out by itself as well: rm: cannot remove `.' or `..'): Code:
rm $(find . -not -name "*.avi" -type f) Code:
rm $(find ./testdir -not -name "*.avi" -type f) |
Quote:
Code:
[zuki@localhost Desktop]$ rm $(find . -not -name "*.torrent" -type f) |
Quote:
Code:
echo $(find . -not -name "*.torrent" -type f) Code:
alias rm='rm -i' |
Quote:
Quote:
Code:
find . -not -name "*.torrent" -type -f -exec rm {} \; There is a maximum size the command line arguments can have, which you can see via Code:
getconf ARG_MAX |
All times are GMT -5. The time now is 05:04 AM. |