mukes has asked for the wisdom of the Perl Monks concerning the following question:
cannot get the exist or glob or size function work with UNC path folders So to work with long folders i used the UNC way to create smaller paths on windows machine. exampel showsn below doesnot have long path. But testing it out to see why these functions don't work
my $directory = "C:\\test\\test2"; $directory =~ s/\//\\/g; if ($directory !~ /^\\\\?\\/ ) {$directoryUNC ="\\\\?\\".$direct +ory }; $len = length($directoryUNC ); $directoryshort = Win32::GetShortPathName($directoryUNC ); print "short name for $directory is $directoryshort \n"; chdir "$directoryshort" or die "Failed to go to $directoryshort: $ +!"; $FolderName = getcwd(); opendir DIR, $FolderName or die "Cannot open directory: $!"; while ( defined( my $file = readdir(DIR) ) ) { $fileSize= -s $file; print "file size for $file is $fileSize\n"; }
this does not print the file size. Have tried other things like exists function doesn't work either. Would someone know how to use these functions with the short UNC path
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: size and exist doesnot work with UNC folders/dir
by kcott (Archbishop) on Oct 17, 2013 at 02:48 UTC | |
|
Re: size and exist doesnot work with UNC folders/dir
by bulk88 (Priest) on Oct 17, 2013 at 03:29 UTC | |
|
Re: size and exist doesnot work with UNC folders/dir
by marinersk (Priest) on Oct 17, 2013 at 17:48 UTC | |
|
Re: size and exist doesnot work with UNC folders/dir (yes it does)
by Anonymous Monk on Oct 17, 2013 at 02:27 UTC |