We have a program, Netvault Workstation Backup, and it has created a large directory on our windows pc, that is no longer needed. When trying to delete these, we are getting these windows alerts, saying it cannot delete the directory due to file name being to long. Ive attempted to drill down as much as possible but cannot seem to find an end to this tree.<\/p>\n
Does anyone know of a tool that would be able to just eliminate this entire directory, bypassing the file name length issue.<\/p>","upvoteCount":10,"answerCount":12,"datePublished":"2015-08-11T12:32:18.000Z","author":{"@type":"Person","name":"brianfulcher","url":"https://community.spiceworks.com/u/brianfulcher"},"acceptedAnswer":{"@type":"Answer","text":"
You can mount the folder as a drive and then delete via that.<\/p>\n
For example:<\/p>\n
\\server\\very\\long\\directory\\that\\i\\cant\\delete\\ ← mount as X:<\/p>\n
Now you can delete files from X:\\ without problems.<\/p>","upvoteCount":6,"datePublished":"2015-08-11T12:40:18.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/2","author":{"@type":"Person","name":"oliverkinne","url":"https://community.spiceworks.com/u/oliverkinne"}},"suggestedAnswer":[{"@type":"Answer","text":"
We have a program, Netvault Workstation Backup, and it has created a large directory on our windows pc, that is no longer needed. When trying to delete these, we are getting these windows alerts, saying it cannot delete the directory due to file name being to long. Ive attempted to drill down as much as possible but cannot seem to find an end to this tree.<\/p>\n
Does anyone know of a tool that would be able to just eliminate this entire directory, bypassing the file name length issue.<\/p>","upvoteCount":10,"datePublished":"2015-08-11T12:32:18.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/1","author":{"@type":"Person","name":"brianfulcher","url":"https://community.spiceworks.com/u/brianfulcher"}},{"@type":"Answer","text":"
I have not found a tool to do this. I had to manually rename all files that exceeded the character limit, then I could delete it. I just had to do this last week for reference.<\/p>","upvoteCount":0,"datePublished":"2015-08-11T12:40:46.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/3","author":{"@type":"Person","name":"wiesedj22","url":"https://community.spiceworks.com/u/wiesedj22"}},{"@type":"Answer","text":"
Any chance you can create a shortcut or map a drive to a location in the middle of the mess. Once you clear from the middle to end, you can work your way back up???<\/p>","upvoteCount":0,"datePublished":"2015-08-11T12:41:32.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/4","author":{"@type":"Person","name":"rbtechguy","url":"https://community.spiceworks.com/u/rbtechguy"}},{"@type":"Answer","text":"
To map locally, use the subst command:
\nsubst x:\\very\\long\\directory\\that\\i\\cant\\delete\\<\/p>\n
then delete from the x drive. Just remember the directory path will have a limit as well…<\/p>","upvoteCount":2,"datePublished":"2015-08-11T12:47:57.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/5","author":{"@type":"Person","name":"davidrossi","url":"https://community.spiceworks.com/u/davidrossi"}},{"@type":"Answer","text":"
I was also going to suggest use of subst. There’s a missing space in the above command though:<\/p>\n
subst x: c:\\very\\long\\path\\etc\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2015-08-11T12:53:03.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/6","author":{"@type":"Person","name":"alexbluemel7759","url":"https://community.spiceworks.com/u/alexbluemel7759"}},{"@type":"Answer","text":"You can easily rename parts of the path to shorter names.<\/p>\n
If you have c:\\longname1\\longname2.…<\/p>\n
c:> ren longname1 a<\/p>\n
c:>cd a<\/p>\n
c:\\a> ren longname2 b<\/p>\n
etc.<\/p>\n
until it’s short enough to delete the entire path.<\/p>","upvoteCount":7,"datePublished":"2015-08-11T12:57:41.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/7","author":{"@type":"Person","name":"Robert5205","url":"https://community.spiceworks.com/u/Robert5205"}},{"@type":"Answer","text":"
I had this recently and what I did was drill down a ways and then take and move one of the deeper folders into the root of the drive using file explorer. I was then able to delete the entire path.<\/p>\n
Now, I haven’t always been able to do it that way. I try drilling down until I can delete the folders inside whatever folder I’m in. Sometimes the name of the file itself has to be changed. In that instance I just start renaming files 1, 2, 3, 4, a, b, c, d, etc.<\/p>","upvoteCount":0,"datePublished":"2015-08-11T15:10:41.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/8","author":{"@type":"Person","name":"dcreitz","url":"https://community.spiceworks.com/u/dcreitz"}},{"@type":"Answer","text":"
Did you try the command prompt RD (or RmDir)?<\/p>\n
For example, say the path is F:\\dir1\\sub1\\blah\\blah\\blah\\blah[many folders deep]\\<\/p>\n
Go to the root of the F: drive and run this in a command prompt:<\/p>\n
RD /S F:\\dir1<\/p>\n
Substitute dir1 with the actual name of the folder off of the root of F: or where ever you want to start deleting the files.<\/p>","upvoteCount":2,"datePublished":"2015-08-11T16:36:26.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/9","author":{"@type":"Person","name":"richardwright","url":"https://community.spiceworks.com/u/richardwright"}},{"@type":"Answer","text":"
Use a Linux boot CD and delete from Linux. My favorite is Puppy Linux and Hiren CD.<\/p>","upvoteCount":1,"datePublished":"2015-08-11T20:04:25.000Z","url":"https://community.spiceworks.com/t/how-to-delete-when-file-path-is-too-long/426761/10","author":{"@type":"Person","name":"harry1028","url":"https://community.spiceworks.com/u/harry1028"}},{"@type":"Answer","text":"
I deal with this a lot, and there isn’t any easy way to remove these files, short of mapping a drive to a subfolder or changing the names of folders in the path. Although, if there’s a 3rd-party file explorer tool available that uses the Unicode versions of API calls, it should<\/em> be able to remove those files.<\/p>\nMSDN has a rather comprehensive, yet relatively accessible discussion of file system object names and how you can end up with files with names that are too long to delete in Explorer.<\/p>\n