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

    Windows CLI - Find long Filepaths and compress to zip

    IT Discussion
    windows command line compression file path file system long file name powershell cmd
    3
    3
    605
    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 scottalanmiller

      I'm looking for a way with Windows CLI or Powershell to scan for and find long file paths on a server (those exceeding the default limit) and compress the top 3 parent folders into a zip file that matches the uppermost folder name.

      Anyone have anything that would work?

      1 Reply Last reply Reply Quote 2
      • scottalanmillerS
        scottalanmiller
        last edited by

        There is like no one publishing how to do this, which is really weird. Finding long filenames is apparently really hard.

        Here is what StackOverflow says to do.

        dir /s /b > out.txt
        cmd /c dir /s /b |? {$_.length -gt 260}
        

        In PowerShell. That would produce the list, apparently. Then from there, there is a list to compress from.

        1 Reply Last reply Reply Quote 4
        • gjacobseG
          gjacobse
          last edited by

          Long file names can be a serious pain... for copy and backup reasons.

          I recall a NTG client that used a long name for the directories,.. and it made updating nearly impossible Should follow the KISS method... Directory names don't need to be 120 characters long,.. and four deep.

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