Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find files with a path length greater than 260 characters in Windows?

I'm using a xcopy in an XP windows script to recursively copy a directory. I keep getting an 'Insufficient Memory' error, which I understand is because a file I'm trying to copy has too long a path. I can easily reduce the path length, but unfortunately I can't work out which files are violating the path length restriction. The files that are copied are printed to the standard output (which I'm redirecting to a log file), but the error message is printed to the terminal, so I can't even work out approximately which directory the error is being given for.

like image 691
WestHamster Avatar asked Oct 02 '12 19:10

WestHamster


People also ask

Why does Windows have a 260 character limit?

The 260-character path limit is due to fixed buffers in the runtime library for DOS/Windows path processing (e.g. ANSI <=> Unicode, working directory, and DOS<=>NT path conversion).


1 Answers

do a dir /s /b > out.txt and then add a guide at position 260

In powershell cmd /c dir /s /b |? {$_.length -gt 260}

like image 192
rerun Avatar answered Oct 19 '22 19:10

rerun