locked
The filename would be too long for the destination folder server 2012 RRS feed

  • Question

  • Hi Supports,

    We have facing some problem in win 2012 server.I am copy file to server and come to error message is as follow: the filename would be too long for the destination folder server 2012.

    Thanks & regards,

    Roshan

    M.no.9999484994

    Email: roshan@adaan.com

    Monday, December 29, 2014 8:58 AM

Answers

  • Hi Roshan,

    This happens usually when you are trying to copy files from NFS fileshare 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."

    How long can a file name be?   

    It depends on the length of the complete path to the file (such as C:\Program Files\filename.txt). Windows limits a single path to 260 characters. This is why you might occasionally get an error when copying a file with a very long file name to a location that has a longer path than the file's original location.

    Workarounds:

    You can use some tool like copy, xcopy or something to rename the destination file before it gets copied.

    How are you currently copying the files.

    You can try Robocopy:

    The Robocopy command line utility, which is natively deployed with Server 2008 and server 2012, 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(MountPoint) DESTINATION(Production data path) /E /ZB /COPYALL /DCOPY:DAT /log:C:\LOG.TXT /NJH /TEE
    
     
    

    Explanation of Robocopy switches

    /E to copy everything including empty folders
    /ZB to copy files in restartable mode (to survice a network glitch), then if it fails uses backup mode
    /COPYALL copies everything including ACLs
    /DCOPY:DAT copies all directory information including timestamps and attributes
    /LOG:C:\log.txt outputs all information into a log file
    /NJH hides the job header
    /TEE also outputs to the screen

    References:

    https://support.software.dell.com/appassure/kb/122956


    Regards,

    Satyajit

    Please “Vote As Helpful” if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

    Monday, December 29, 2014 11:02 AM

All replies

  • Hi Roshan,

    This happens usually when you are trying to copy files from NFS fileshare 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."

    How long can a file name be?   

    It depends on the length of the complete path to the file (such as C:\Program Files\filename.txt). Windows limits a single path to 260 characters. This is why you might occasionally get an error when copying a file with a very long file name to a location that has a longer path than the file's original location.

    Workarounds:

    You can use some tool like copy, xcopy or something to rename the destination file before it gets copied.

    How are you currently copying the files.

    You can try Robocopy:

    The Robocopy command line utility, which is natively deployed with Server 2008 and server 2012, 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(MountPoint) DESTINATION(Production data path) /E /ZB /COPYALL /DCOPY:DAT /log:C:\LOG.TXT /NJH /TEE
    
     
    

    Explanation of Robocopy switches

    /E to copy everything including empty folders
    /ZB to copy files in restartable mode (to survice a network glitch), then if it fails uses backup mode
    /COPYALL copies everything including ACLs
    /DCOPY:DAT copies all directory information including timestamps and attributes
    /LOG:C:\log.txt outputs all information into a log file
    /NJH hides the job header
    /TEE also outputs to the screen

    References:

    https://support.software.dell.com/appassure/kb/122956


    Regards,

    Satyajit

    Please “Vote As Helpful” if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

    Monday, December 29, 2014 11:02 AM
  • Hi Roshan,

    I'm using Long Path Tool for these kind of problems

    Thursday, February 12, 2015 12:06 PM
  • The simplest way is to go to the folder which contains the long name.  Then in the ribbon, under "File," select "open command prompt as administrator."  Next use the del command on the file extension name.  For example, my overly-long files had the file extension ".dat"  So the command I used was "del *.dat"  (without the quotes, of course).  This old DOS command will get rid of the files.
    Thursday, August 20, 2015 6:53 PM