ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Question - how to use tar to compress multiple top level folders recursively into discrete zip files

    IT Discussion
    4
    20
    331
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      Well of the --- folder never changes, but the content beneath it does, that would be what I would target.

      I'm trying to resolve our user base breaking our backups by have file paths longer than 255 characters, which the simplest way I can think of is to just compress everything in --- folder.

      1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller @JasGot
        last edited by

        @JasGot said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

        @DustinB3403 said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

        Does it matter, the tar process is tar?

        But osx is likely where this would be run from.

        Because I was going to write a cmd for loop for you if it were Win, and I was going to pass if it were *nix.

        It's the shell, not the OS, that determines the looping structure. PowerShell on Linux is the same as on Windows. Bash on Windows is the same as on Linux. 🙂

        1 Reply Last reply Reply Quote 0
        • ObsolesceO
          Obsolesce
          last edited by

          I don't follow your - - - naming scheme. Can you explain differently?

          DustinB3403D 1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403 @Obsolesce
            last edited by

            @Obsolesce said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

            I don't follow your - - - naming scheme. Can you explain differently?

            Yeah the spacing didn't copy over from mobile.

            Essentially it's

            Root folder

            • sub folder
              • child folder
            • different sub folder from root
              • child folder
            1 Reply Last reply Reply Quote 0
            • DustinB3403D
              DustinB3403
              last edited by

              Okay so this is the next annoyance with this, I am getting the entire parent folder up until the target folder in the compressed file.

              IE: compressed-folder.tar contains

              • Share Name
                • Sub-Parent-Folder
                  • Next-Level-Parent-Folder
                    • Target-Folder
                      . . . . all of the files and sub-folders

              Anyway to have tar just target the Target-Folder that is on an SMB share, compress that specifically (and it's children to a single file) so I can then move that compressed file without all of the overhead folder structure?

              ObsolesceO 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403
                last edited by

                I suppose I could mount each and every Target-Folder but that seems completely counter intuitive and a massive effort. . .

                1 Reply Last reply Reply Quote 0
                • ObsolesceO
                  Obsolesce @DustinB3403
                  last edited by

                  @DustinB3403 said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

                  Okay so this is the next annoyance with this, I am getting the entire parent folder up until the target folder in the compressed file.

                  IE: compressed-folder.tar contains

                  • Share Name
                    • Sub-Parent-Folder
                      • Next-Level-Parent-Folder
                        • Target-Folder
                          . . . . all of the files and sub-folders

                  Anyway to have tar just target the Target-Folder that is on an SMB share, compress that specifically (and it's children to a single file) so I can then move that compressed file without all of the overhead folder structure?

                  Why not specify /path/to/targetfolder/

                  DustinB3403D 1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403 @Obsolesce
                    last edited by DustinB3403

                    @Obsolesce said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

                    Why not specify /path/to/targetfolder/

                    I'm not following what you mean.

                    How I'm currently doing this is tar -zcvf Compressed.zip /Volumes/Parent/Child/Target-folder/

                    Edit:

                    And I get everything in the path /Volumes/Parent/Child/Target-folder/ so the compressed file, when decompressed is /Volumes/Parent/Child/Target-Folder/some-stuff

                    What I want is just Target-Folder and it's contents, not the parent folder path.

                    1 Reply Last reply Reply Quote 0
                    • DustinB3403D
                      DustinB3403
                      last edited by

                      Supposedly tar -C /Volumes/Parent/Child/Target-folder -cvf Compressed.zip SelectedDirectory works. . . let me test that.

                      DustinB3403D 1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403 @DustinB3403
                        last edited by

                        @DustinB3403 said in Question - how to use tar to compress multiple top level folders recursively into discrete zip files:

                        Supposedly tar -C /Volumes/Parent/Child/Target-folder -cvf Compressed.zip SelectedDirectory works. . . let me test that.

                        Okay so that does work, just is a pain in the rear to have to do manually.

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post