Can a shell loop do this?

Posted by helpwithshell on Stack Overflow See other posts from Stack Overflow or by helpwithshell
Published on 2010-04-25T16:41:33Z Indexed on 2010/04/25 16:53 UTC
Read the original article Hit count: 175

Filed under:
|
|
|
|

Ive seen loops to unzip all zip files in a directory, however, before I run this, I would rather make sure what Im about to run will work right:

for i in dir; do cd $i; unzip '*.zip'; rm -rf *.zip; cd ..; done

Basically I want it to look at the output of "dir" see all the folders, for each directory cd into it, unzip all the zip archives, then remove them, then cd back and do it again until theres no more.

Is this something I should do in a single command or should I consider doing this in perl?

© Stack Overflow or respective owner

Related posts about shell

Related posts about loop