How to compress multiple folders, each into its own zip archive and choose destination. For example: I have mounted device "ssd" I have a lot of folders :


And I want get:

  • Sorry, in real I have not only three folder but a lot of folders – user5838778 Jun 24 '17 at 22:17

Using zip utility:

-- changing the current directory to user1:

cd user1/

-- compressing all folders within current directory:

for f in */; do zip -rq "/media/user1/ssd/MyBackUp/${f%/}.zip" "$f"; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.