in reply to Re: File::Find giving unexpected results under windows
in thread File::Find giving unexpected results under windows
hi,
when i used File::Find to search a whole drive under windows sometimes my script died with e.g.
Can't cd to ../../../../../../../../../../../../.. from C:/Dokumente und Einstellungen/User/Anwendungsdaten/Macromedia/Flash Player/#SharedObjects/3V6TWZWS/static.sf-cdn.com/MD5=02b6557eb0995f2859ece9db3a0ce8fb/default/swf/v4_0/platform/bin/com/snapfish/modules/controllers/upload/UploadController.swf at D:/usr/lib/File/Find.pm line 983, <STDIN> line 1.i've learned that this is due to the Windows MAX_PATH length of 260 chars and the chdir() implementation (which seems to append all the ../../../../../.... to the actual path).
a simple solution shifts that problem almost out of the way (up to a max. pathlength of 258 chars in windows, does not interfere with other os)
insert in Find.pm at line 983:
chdir ('..') or die "Can't cd to .. from $dir_name" while $tmp =~ s/^\.\.\///o;then that code should (nice) look like
$tmp = join('/',('..') x ($CdLvl-$Level)); } chdir ('..') or die "Can't cd to .. from $dir_name" while $tmp =~ s/^\.\.\///o; die "Can't cd to $tmp from $dir_name" unless chdir ($tmp);
|
|---|