On Mon, 2006-03-13 at 17:47 -0600, Jordan Peacock wrote: > Something like this? > > find . -name '*.tar' '*.zip' '*.rar' -exec # is there some > symbol denoting 'or'? > if.... > then... > > #!/bin/bash > > for i in *.rar; do > mkdir `basename $i .rar`.dir > cd `basename $i .rar`.dir > unrar e ../$i > cd .. > done > > # Brian Hurt's original > > for i in *.tar; do > mkdir `basename $i .tar`.dir > cd `basename $i .tar`.dir > tar xvf ../$i > cd .. > done > If you need if/else logic you need to write a shell script. Find won't cut it on it's own, even though it does have "and" and "or". Something like this will work: #!/bin/bash for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip'; do case $i in *.tar) tar -xvf $i ;; *.rar) rar... ;; *.zip) zip... ;; esac done The case statement switches between multiple options. "esac" ends the case statement. Each option is listed with some string followed by ")". That string can use shell expressions for matching. The code in the option gets executed until ";;'. Note that this find will find all files recursively in the current directory. If you just want all of the files in a directory change the find to: "*.zip *.rar *.tar". ________________________________________________________________________ Jon Schewe | http://mtu.net/~jpschewe If you see a signature.asc file attached to the message this is my digital signature. See http://www.gnupg.org for more information. For I am convinced that neither death nor life, neither angels nor demons, neither the present nor the future, nor any powers, neither height nor depth, nor anything else in all creation, will be able to separate us from the love of God that is in Christ Jesus our Lord. - Romans 8:38-39 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20060314/02c8aa5d/attachment-0001.pgp