1

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 :

home/user1/folder1
home/user1/folder2
...
home/user1/folderN

And I want get:

/media/user1/ssd/MyBackUp/folder1.zip
/media/user1/ssd/MyBackUp/folder2.zip
...
/media/user1/ssd/MyBackUp/folderN.zip
  • Sorry, in real I have not only three folder but a lot of folders – user5838778 Jun 24 '17 at 22:17
1

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.