Can’t Delete File/Folder – Path Too Long

I ran into a scenario where I had used Robocopy to /COPYALL out to an external USB drive for a backup of a rather large directory. One of the source directories had about 40 hidden subfolders stacked within itself which robocopy copied out to the external drive. All of these folders file paths on my external drive now surpassed the limit of 255 characters which essentially renders them useless in the GUI. These duplicate hidden subfolders were something that I wanted to:

– delete from the destination media

– exclude from any future robocopy copyouts

The quick fix I found was to drill down into the USB drive about half way through the nested subfolders, right-click and share one of the duplicates out, giving permission to ‘Everyone’. From my host PC, I was able to go to¬† \\SERVER\*newshare* and delete all subfolders/files from that point as the relative path was then lower than 255 characters. Go back into the server, remove the share, and move it higher up in the tree if necessary to work yourself out of the 255 character limit.

I then added the exclusion (in italics below) to my robocopy script to avoid copying that directory again and recreating the issue:

robocopy “C:\Graphics” “F:\Graphics” /NP /E /R:3 /W:5 /ZB /XD “C:\Graphics\Videos\Edits” /LOG:”C:\Backup_log.txt”

3 thoughts on “Can’t Delete File/Folder – Path Too Long”

Leave a Reply

Your email address will not be published. Required fields are marked *


*