Currently, I have this directory structure:
/Downloads
/Download 1/
/Download 2/
/Download 3/
...
I would like to have this directory structure:
/Downloads
Download 1.zip
Download 2.zip
Download 3.zip
...
Essentially, I want to zip Download 1 into Download 1.zip
and then remove Download 1.
What would be the fastest/easiest way to achieve this? I'm running Ubuntu 12.04.
The reason I'm asking is because this folder is shared on my local network. When people ask this on my Apache Web Server, I want them to download Download 1
, so I need it to be a zip file.
for i in ~/sandbox/*; do zip -r "$i".zip "$i" && rm -rf "$i"; done
-- that way therm
will only be executed if thezip
succeeds, see here – evilsoup Dec 01 '13 at 19:45