moving files to a folder and zip the folder

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















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.










share|improve this question



















  • 3





    Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

    – terdon
    Oct 6 '14 at 22:42















1















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.










share|improve this question



















  • 3





    Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

    – terdon
    Oct 6 '14 at 22:42













1












1








1








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.










share|improve this question
















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.







zip gzip mv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 9 '14 at 3:01









Community

1




1










asked Oct 6 '14 at 22:33









Boo NaBoo Na

1112




1112







  • 3





    Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

    – terdon
    Oct 6 '14 at 22:42












  • 3





    Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

    – terdon
    Oct 6 '14 at 22:42







3




3





Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

– terdon
Oct 6 '14 at 22:42





Your question is very hard to understand. Please edit and show us an example of the files and directories involved.

– terdon
Oct 6 '14 at 22:42










3 Answers
3






active

oldest

votes


















1














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





share|improve this answer
































    1














    cp -R (the path of the folder to copy) (the name of the copied file)


    then



    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).






    share|improve this answer






























      0














      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.






      share|improve this answer






















        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "106"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f159712%2fmoving-files-to-a-folder-and-zip-the-folder%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        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





        share|improve this answer





























          1














          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





          share|improve this answer



























            1












            1








            1







            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





            share|improve this answer















            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






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Oct 6 '14 at 22:59

























            answered Oct 6 '14 at 22:36









            vembutechvembutech

            26515




            26515























                1














                cp -R (the path of the folder to copy) (the name of the copied file)


                then



                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).






                share|improve this answer



























                  1














                  cp -R (the path of the folder to copy) (the name of the copied file)


                  then



                  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).






                  share|improve this answer

























                    1












                    1








                    1







                    cp -R (the path of the folder to copy) (the name of the copied file)


                    then



                    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).






                    share|improve this answer













                    cp -R (the path of the folder to copy) (the name of the copied file)


                    then



                    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).







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 31 '17 at 12:40









                    StefanoWPStefanoWP

                    112




                    112





















                        0














                        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.






                        share|improve this answer



























                          0














                          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.






                          share|improve this answer

























                            0












                            0








                            0







                            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.






                            share|improve this answer













                            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.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 4 at 21:23









                            Jim L.Jim L.

                            11




                            11



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f159712%2fmoving-files-to-a-folder-and-zip-the-folder%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown






                                Popular posts from this blog

                                How to check contact read email or not when send email to Individual?

                                Displaying single band from multi-band raster using QGIS

                                How many registers does an x86_64 CPU actually have?