I have to zip a few files induvidually from folder A and move them to folder B on the same directory which takes lot of time. So I thought of moving all those files to be zipped to a new folder(c), zip it and move it to folder B . Is it possible to do it with few commands? suggestions are welcomed.

  • 3
    Your question is very hard to understand. Please edit and show us an example of the files and directories involved.
    – terdon
    Commented Oct 6, 2014 at 22:42

3 Answers 3


Possibly a shell type of script could help you:

enter code here
  mv <file.a>...<file.n> <new_folder>
  zip -r <new_folder>
  mv new_folder.zip /destination_folder
cp -R (the path of the folder to copy) (the name of the copied file)


zip -r (name your zip) (the name of the copied file)

Example scenario: Let's say that I want to copy the plugins of a WordPress installation and after zip them (while I'm in the root folder of WordPress).

I will do:

cp -R wp-content/plugins plugins_backup

then to check I'll do:

ls -la

I will see the new directory plugins_backup, and I will zip it:

zip -r plugins_backup.zip plugins_backup

ready. (then follow the answer of mv to move it anywhere).


Somehow I've been ignorant all this time of the FUSE plug-in for ZIP file support. It allows the user to mount (or create) a ZIP file as though it were a read/write filesystem.

First create a new (empty) file ending in .zip and mount it on /mnt. Since you want the ZIP file to eventually end up in folder_B, we'll create it there:

# rm -f /folder_B/my_files.zip
# fuse-zip /folder_B/my_files.zip /mnt

Your post isn't clear, but it sounds like you want the .ZIP file to contain folder_C, and then all your files reside there. So we'll create folder_C inside the .ZIP file that's on /mnt:

# mkdir /mnt/folder_C

Now you can simply go into folder_A and move all the files you want to be zipped into /mnt/folder_C:

# cd /folder_A
# mv file1 file2 ... fileN /mnt/folder_C

Finally, unmount and inspect the ZIP file:

# umount /mnt
# unzip -v /folder_B/my_files.zip

I realize this looks convoluted, but the basic four steps are:

# fuse-zip /folder_B/my_files.zip /mnt
# mkdir /mnt/folder_C
# mv /folder_A/file1 /folder_A/file2 ... /folder_A/fileN /mnt/folder_C
# umount /mnt

I don't mean to imply this is method is any better nor worse than the other solutions, just a different way to do it. I hope you find it interesting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .