I've so far figured out how to use find to recursively unzip all the files:
find . -depth -name `*.zip` -exec /usr/bin/unzip -n {} \;
But, I can't figure out how to remove the zip files one at a time after the extraction. Adding rm *.zip in an -a -exec ends up deleting most of the zip files in each directory before they are extracted. Piping through a script containing the rm command (with -i enabled for testing) causes find to not find any *.zips (or at least that's what it complains). There is, of course, whitespace in many of the filenames but at this point syntaxing in a sed command to add _'s is a bit beyond me. Thank for your help!
recursively
, zip in zip? For complex tasks, personally I'd write a helper script (sayunzip-and-rm.sh
) and -exec that script. – Uniocularunzip-and-rm
into a script and -exec it, but it fails to find any zip files, and I suspect it's due to to the spaces in the filenames. – Wehrmachtit fails to find any zip files
, I can't believe it, could you paste the command line? – Uniocularrm $f
,mv $f
to the .sh file - or add any other command, if you like. – Ferwerda