vendredi 6 février 2015

Creating a file under a directory whose name length exceeds 220 characters


I'm experiencing a problem where I cannot create a file under directory whose lenght of its name exceeds 220 characters.


The following is a test script that reproduces the observed behavior, at least on my machine:



use warnings;
use strict;

use Win32::LongPath;

print system ('rmdir /s /q test');
mkdirL('test');

for my $i (200 .. 255) {

my $dir_name = 'test/' . sprintf("%04d", $i) . ('a' x ($i-4));
mkdirL($dir_name);

openL(\my $fh, '>', "$dir_name/" . ('_' x 200) . '.txt') or die "$^E";
print $fh 'Hello!';
# closeL $fh;
}


This script will create a _________.....___.txt file under 0220aaaa...aaa/ but not under 0221aaaa...aaa.


Is there a reason for this problem and how can I change the script so that the *.txt file is created in all directories?





Aucun commentaire:

Enregistrer un commentaire