Skip to content

Instantly share code, notes, and snippets.

@dhoko
Created February 17, 2014 10:34
Show Gist options
  • Save dhoko/9048292 to your computer and use it in GitHub Desktop.
Save dhoko/9048292 to your computer and use it in GitHub Desktop.
Compress each files inside a directory
for directory in $(ls)
do
echo Move to $directory;
cd $directory && zip $directory * && cd .. && mv $directory/$directory.zip . || echo Erro meine cheneral;
done;
@dhoko
Copy link
Author

dhoko commented Feb 17, 2014

Ex :

  • videos/
    • videos/
      • video1.mp4
      • video2.mp4
    • dir2/
      • video1.mp4
      • video2.mp4

===>

  • videos/
    • videos/
      • video1.mp4
      • video2.mp4
    • videos.zip
    • dir2/
      • video1.mp4
      • video2.mp4
    • dir2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment