ERROR :The specified path, file name, or both are too long.

Thread is closed for posting
10 posts, 0 answers
  1. Ajay
    Ajay avatar
    66 posts
    Member since:
    May 2009

    Posted 30 Nov 2009 Link to this post

    Hi telerik Guys !

    Im using RAD FILE EXPLORER as the main control in my current project.

    Actually what Iam here trying is to create a nested ROOT structure just like :-

    ----Root
            :
            : -------Child Folder 1
                        :
                        :---------Child Folder 1a
                                    :
                                    :---------Child Folder 1a(i)
                                                :
                                                :--------Child Folder 1a[i(a)]
                                    
    Now when I try to UPLOAD an file within the Child Folder 1a[i(a)] folder Im getting the below mentioned error  in my CustomFileSystemProvider.cs class:-

    "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."

    Below is the code that is creating an problem :-

     public override DirectoryItem ResolveRootDirectoryAsTree(string path)  
        {  
            string physicalPath;  
            string virtualPath = string.Empty;  
     
            if (this.IsPhysicalPath(path))  
            {// The path is a physical path ;  
                physicalPath = path;  
     
                foreach (KeyValuePair<string, string> mappedPath in MappedPaths)  
                {  
                    // Check whether a mapping exists for the current physical paths ;  
                    if (GMP.AddSlashAtEndOfPhysicalPath(physicalPath).ToLower().StartsWith(mappedPath.Value.ToLower()))  
                    {// Exists   
                        virtualPath = Regex.Replace(GMP.AddSlashAtEndOfPhysicalPath(physicalPath), Regex.Escape(mappedPath.Value), mappedPath.Key, RegexOptions.IgnoreCase);  
                        virtualPathvirtualPath = virtualPath.Replace('\\', '/');  
                        virtualPath = GMP.AddSlashAtEndOfVirtualPath(virtualPath);  
                        break;// Exit the 'foreach' loop ;  
                    }  
                }  
     
                // Mappind does not exist ;  
            }  
            else  
            {// Virtual path ;  
                virtualPath = GMP.AddSlashAtEndOfVirtualPath(path);  
                physicalPath = this.GetPhysicalFromVirtualPath(path);  
                if (physicalPath == null)  
                    return null;  
            }  
     
            DirectoryItem result = new DirectoryItem(this.GetDirectoryName(physicalPath), string.Empty, virtualPath, string.Empty, fullPermissions, null, GetDirectories(virtualPath));  
     
            foreach (DirectoryItem dirItem in result.Directories)  
            {  
                // Get the information from the physical directory  
                DirectoryInfo dInfo = new DirectoryInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(dirItem.Path)));  
     
                // Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer  
                // If the name attribute matches the unique name of a grid column  
                DataTable dt = new DataTable();  
                dt = Glb_Entities.ExecuteSPReturnDT(new object[]{"Usp_Dms_FolderDate"  
                                                                 ,"Folder_Path", (dirItem.Path.TrimEnd("/".ToCharArray())).Substring(0,dirItem.Path.TrimEnd("/".ToCharArray()).LastIndexOf("/"))  
                                                                 ,"Folder_Name", dInfo.Name  
                                                                   });  
     
                dirItem.Attributes.Add("CreatedDate", dt.Rows[0]["CreateDate"].ToString());  
                dirItem.Attributes.Add("ModifiedDate", dt.Rows[0]["LatestDate"].ToString());  
     
            }  
            return result;  
        }  
     
    Problem exist in the italized text in the above code.

    Please help ........

    I dont have a clue where Iam getting thing wrong.  ??

    Ajay 
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 30 Nov 2009 Link to this post

    Hi Ajay,

    This exception is not related to our controls. More details about the error and possible workarounds can be found in this blogpost.

    I hope this helps.

    All the best,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kit
    Kit avatar
    1 posts
    Member since:
    Dec 2010

    Posted 10 Dec 2010 Link to this post

       
    I had the same problem. And www.pathtoolongtool.com helped me.
  5. Booby
    Booby avatar
    1 posts
    Member since:
    Dec 2010

    Posted 31 Dec 2010 Link to this post

    I had the similiar problem and finally I found solution:
    www.tooLongPath.com
  6. alan
    alan avatar
    1 posts
    Member since:
    Jan 2011

    Posted 02 Jan 2011 Link to this post

    i also have faced the same problme and following software sort out my problem


    www.longPathTool.com

    some of the features of this softwares are:

    Path too long.
    Error cannot delete file: cannot read from source file or disk.
    Cannot delete file: Access is denied.
    There has been a sharing violation.
    Cannot delete file or folder The file name you specified is not valid or too long.
    Specify a different file name.
    The source or destination file may be in use.
    The file is in use by another program or user.
    Error Deleting File or Folder
    Make sure the disk is not full or write-protected and that the file is not currently in use.
    Path too deep.
  7. Jolfber
    Jolfber avatar
    1 posts
    Member since:
    Mar 2013

    Posted 18 Mar 2013 Link to this post

    Hey guys, I had this problem too. I checked this http://LongPathTool.com and it helped me a lot. You don't need to be a techie kind of guy for this one. I'm not techie as well so this one's a good stuff for me.
  8. Rebecca
    Rebecca avatar
    1 posts
    Member since:
    Jun 2013

    Posted 17 Jun 2013 Link to this post

    Long path tool is the best solution for your problem.try it and solve your problem
  9. Tobie
    Tobie avatar
    8 posts
    Member since:
    Feb 2012

    Posted 21 Aug 2013 Link to this post

    Hi, today I also faced this error when trying to use upgrade wizard on reports, which I did a few times the past week without a problem. After searching for hours to find a solution, I checked the file name/path lengths. Since I did not delete the old backups that the wizard makes and I use the solution's directory to make the backup, each time it includes the previous backup directories in the new backup which results in 254+ lengths - 
    C:\dir\dir\dit\Backup5\dir\Backup4\dir\Backup3\dir\Backup2\dir\Backup1\dir\Backup\dir\Report.cs 254

    Deleting the old backups solved my problem.
  10. patrick
    patrick avatar
    1 posts
    Member since:
    Dec 2014

    Posted 25 Dec 2014 Link to this post

    Hi Ajay

    I suggest to try "Long Path Tool" program .

    before I have problem cannot copy file because file name too long. and after I found long path tool and now my problem solved

    Thanks

    Patrick
  11. Karin
    Karin avatar
    1 posts
    Member since:
    Nov 2015

    Posted 06 Nov 2015 in reply to patrick Link to this post

    Dear Patrick, I am also working of this topic and i find the solution referred from many forums that solve the problem of handing long name issue is a program "Long Path Tool", i think it has features to consider in such conditions.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017