none
The filename would be too long for the destination folder RRS feed

  • Question

  • Hi,

    Getting this error while coping files on a Windows Server 2012 R2.  <o:p></o:p>

    "The filename would be too long for the destination folder. You can shorten the filename and try again or try a location that has a shorten path."<o:p></o:p>

    Any know how to fix this issue?<o:p></o:p>

    <o:p> </o:p>Thanks for the support in advance .

    Thursday, August 22, 2019 6:09 AM

All replies

  • 1. You can use robocopy to copy or  move files.

    ROBOCOPYC:\SourceFoldern D:\DestinationFolder /move

    2. or you can change file names into short

    refer below. these may be helpful to you

    https://theitbros.com/destination-path-too-long-error-when-movingcopying-a-file/

    https://www.eassos.com/blog/how-to-fix-destination-path-too-long/
    Thursday, August 22, 2019 7:32 AM
  • Hi ,

    This happens usually when you are trying to copy files to Windows which has a character limit on filenames.

    "The Windows API has a logical limit of around 255 characters and the behaviour of the described problem is consistent with this."

    As a workaround, you could use Robocopy command to copy files.

    The Robocopy command line utility will overcome the Windows API limit and allow the copying of files / folder paths longer than 255 characters.

    =========================================

    A sample command is included below:

    robocopy source destination /E /ZB /DCOPY:T /COPYALL /R:n /W:n /V /TEE /LOG:Robocopy.log

    source :: Source Directory (drive:\path or \\server\share\path).

    Destination :: Destination Directory  (drive:\path or \\server\share\path).

    /E :: copy subdirectories, including Empty ones.

    /ZB :: use restartable mode; if access denied use Backup mode.

    /DCOPY:T :: COPY Directory Timestamps.

    /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU). Copies the Data, Attributes, Timestamps, Ownser, Permissions and Auditing info

    /R:n :: number of Retries on failed copies: default is 1 million but I set this to only retry once.

    /W:n :: Wait time between retries: default is 30 seconds but I set this to 1 second.

    /V :: produce Verbose output, showing skipped files.

    /TEE :: output to console window, as well as the log file.

    /LOG:file :: output status to LOG file (overwrite existing log).

    =========================================

    For more details about robocopy, please refer to the following link:

    https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

    Here are other workarounds you can refer to:

    Destination Path Too Long Fix (when Moving/Copying a File)

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best Regards,

    Candy




    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com   




    Thursday, August 22, 2019 7:46 AM
  • Hi ,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com   

    Friday, August 23, 2019 1:54 AM
  • You can try LongPathTool. I think it will be helpful for you.
    Friday, August 23, 2019 10:43 AM
  • Hi,

    It will replace any existing file or folders in the destination directory?

    Thanks,

    Saturday, August 24, 2019 12:56 PM
  • Hi ,

    You can use the following switches to skip certain files.

    /xc - exclude changed files
    /xn - exclude newer files
    /xo - exclude older files

    With the Changed, Older, and Newer classes excluded, Robocopy will exclude files existing in the destination directory.

    ===============================

    For example:

    robocopy source destination /E /XC /XN /XO

    :: /E makes Robocopy recursively copy subdirectories, including empty ones.

    :: /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those.

    :: /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those.

    :: /XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those.

    ===============================

    In addition, you could mark the useful reply as answer if you want to end this thread up.
    If there is anything else we can do for you, please feel free to post in the forum.

    Best Regards,
    Candy



    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com   


    Monday, August 26, 2019 2:09 AM
  • Hi ,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com   

    Tuesday, August 27, 2019 2:16 AM
  • Hi ,

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,
    Candy


    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com   

    Wednesday, August 28, 2019 2:18 AM
  • You could also use the SUBST command to create a virtual drive mapping to copy the file to. This would enable you to have the drive mapping direct to the folder in question, effectively shortening the file length itself.

    I've used this a number of times to get around the file length limit when copying a lot of files. Say the source is \\servername\rootfoldername\subfolder1\subfolderA, but the destination is \\LONGERservername\rootfoldername\subfolder1\subfolderA\, and you hit the length limit because the destination path is now 6 characters more, you could use SUBST to map a drive letter directly to subfolderA and the files should copy as the drive is now Z:\subfolderA as it doesn't use the full path in the limit. The files can copy and are accessible :)

    Hope that makes sense.

    Steve.

    Thursday, September 19, 2019 11:08 AM