This is a migrated thread and some comments may be shown as answers.

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

9 Answers 930 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ajay
Top achievements
Rank 2
Ajay asked on 30 Nov 2009, 11:14 AM
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 

9 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 30 Nov 2009, 01:23 PM
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.
0
Kit
Top achievements
Rank 1
answered on 11 Dec 2010, 03:36 AM
   
I had the same problem. And www.pathtoolongtool.com helped me.
0
Booby
Top achievements
Rank 1
answered on 31 Dec 2010, 04:47 PM
I had the similiar problem and finally I found solution:
www.tooLongPath.com
0
alan
Top achievements
Rank 1
answered on 02 Jan 2011, 04:30 PM
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.
0
Jolfber
Top achievements
Rank 1
answered on 19 Mar 2013, 01:43 AM
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.
0
Rebecca
Top achievements
Rank 1
answered on 17 Jun 2013, 06:26 PM
Long path tool is the best solution for your problem.try it and solve your problem
0
Tobie
Top achievements
Rank 1
answered on 21 Aug 2013, 10:15 AM
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.
0
patrick
Top achievements
Rank 1
answered on 25 Dec 2014, 08:33 AM
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
0
Karin
Top achievements
Rank 1
answered on 06 Nov 2015, 06:22 PM
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.
Tags
FileExplorer
Asked by
Ajay
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Kit
Top achievements
Rank 1
Booby
Top achievements
Rank 1
alan
Top achievements
Rank 1
Jolfber
Top achievements
Rank 1
Rebecca
Top achievements
Rank 1
Tobie
Top achievements
Rank 1
patrick
Top achievements
Rank 1
Karin
Top achievements
Rank 1
Share this question
or