I've found part of the difficulty; Files names are being separated at each space, making a single file being broken up into unintelligible fragments (example below) I wrote/ran this code to check it: #!/bin/bash for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip'`; do print "$i" done And a sample of the output (1 file, called Down #001 - Down (Part 1).tar); Error: no such file "./Down" Warning: unknown mime-type for "#001" -- using "application/*" Error: no such file "#001" Warning: unknown mime-type for "-" -- using "application/*" Error: no "print" mailcap rules found for type "application/*" Warning: unknown mime-type for "Down" -- using "application/*" Error: no such file "Down" Warning: unknown mime-type for "(Part" -- using "application/*" Error: no such file "(Part" Error: no such file "1).tar" As noted by Dave Sherohman, the backtick in `; do was added, and Don Sparish recommended the check (thank you for the sample code); i've added double-quotes to $i above but it doesn't seem to deal with this issue of spaces in filenames yet. What would this Warning about mime-type have to do with anything? I haven't tested the unpackaging code as yet, I'm dealing with the find function first. *grins* -jordan On 3/14/06, dalan at visi.com <dalan at visi.com> wrote: > Jordan, > > In the "for" command the find is not contained in backticks. Right after the > last command and before the semicolon there needs to be a backtick as well. I > would also think you need to tell find what you want to do once the file is > found either an -ls or -print command. > > I would suggest checking the content of $i before the case command to see what > it contains. > > > Something like the following. > #!/bin/bash > for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip' -print`; do > echo $i > case $i in > > Just a thought. > > Don Sparish > > Quoting Jordan Peacock <hewhocutsdown at gmail.com>: > > > Brian, I have a question about your code specifically, as I've been > > trying to modify it, without success. Here's the current incarnation: > > > > #!/bin/bash > > for i in `find . -name '*.tar' -o -name '*.rar' -o -name '*.zip'; do > > case $i in > > *.tar) > > mkdir `basename $i .tar`.dir > > cd `basename $i .tar`.dir > > tar xvf ../$i > > cd .. > > ;; > > *.rar) > > mkdir `basename $i .rar`.dir > > cd `basename $i .rar`.dir > > unrar e ../$i > > cd .. > > ;; > > *.zip) > > mkdir `basename $i .zip`.dir > > cd `basename $i .zip`.dir > > unzip -d ../$i > > cd .. > > ;; > > esac > > done > > > > The find definately works. I've tested that. But I haven't been able > > to get any of the rest to actually do what it's supposed to, and I > > don't understand what's happening clearly enough. So.... > > > > *.tar) # this is the case identifier > > mkdir `basename $i .tar`.dir # making a new directory, with $i > > being all characters before .tar. What is the significance of basename > > or the single quotes? Does .dir change it's 'extension' to a > > directory? > > cd `basename $i .tar`.dir # we're moving into the newly made > > directory, although i'm not sure why the .tar stuff is still there; > > it's a directory now, right? > > tar xvf ../$i # we execute tar and look for the file $i in the > > parent directory > > cd .. # moving back into the parent dir for the next file > > ;; # denotes end of case > > > > > > I'm experiencing some errors at the cli as well; > > > > line 18: unexpected EOF while looking for matching ``' > > cd `basename $i .zip`.dir # this is the trouble line > > line 25: syntax error: unexpected end of file # there is no line 25 ? > > The code ends at 24. > > > > I have to say a huge thank you to everyone who has contributed. I know > > these are kind of stupid questions, but the shell scripting tutorials > > aren't covering a lot of this. Thank for stepping me through this > > beginner shell script. > > > > -jordan > > > > _______________________________________________ > > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > > tclug-list at mn-linux.org > > http://mailman.mn-linux.org/mailman/listinfo/tclug-list > > > > > > > _______________________________________________ > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > tclug-list at mn-linux.org > http://mailman.mn-linux.org/mailman/listinfo/tclug-list >