Find long filename on a server?
Find long filename?
Hello,
Do you know a software (or a script) to find/list long filename (more than 255 characters) on a server (Win 2003R2 SP2)?
I've tried "Long Filename Finder" v1.1 (http://dcsoft.com/products/longff/longff.htm), but it doesn't function correctly on Win 2003.
Thanks,
Christophe
August 23rd, 2010 12:42am
I found this Perl script when searching on the internet, it may help you:
[simple Perl-script]
# check if filenames are longer then 64 characters
# and if filename+path are longer then 255 characters
# as this makes resetting permissions or copying
# files a nightmare
use File::Basename;
$szFolder=shift @ARGV;
$szLogFile=shift @ARGV;
if ($szFolder eq "")
{
parameters();
} else {
if ($szLogFile eq "")
{
parameters();
} else {
# open logfile
open(OUTPUTFILE,">$szLogFile") || die;
listfiles($szFolder);
close(OUTPUTFILE);
}
}
sub listfiles
{
local $szBaseDir=$_[0];
use File::Find;
sub process_dirs
{
$szPath=$File::Find::name;
$szFile=basename($szPath);
print "Checking: $szFile\n";
if ((length $szPath) > 255)
{
$nPathLength=length $szPath;
print "Full pathname $szPath is $nPathLength characters, which exceeds limit of 255 characters\n";
print OUTPUTFILE "Full pathname $szPath is $nPathLength characters, which exceeds limit of 255 characters\n";
}
if ((length $szFile) > 64)
{
$nFileNameLength=length $szFile;
print "File $szPath is $nFileNameLength characters, which exceeds filename limit of 64 characters\n";
print OUTPUTFILE "File $szPath is $nFileNameLength characters, which exceeds filename limit of 64 characters\n";
}
}
find (\&process_dirs, $szBaseDir);
}
sub parameters
{
print "Usage: Check-files-and-paths.pl path logfile\n";
}
[end of Perl-script]
So get a machine with Perl installed (note only standard Perl modules are used here), kick-off the script like this
"Check-files-and-paths.pl D:\ C:\I-HATE-FILES-WITH-LONG-PATHNAMES.TXT"
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 1:00am
This is where I found it:
http://arstechnica.com/civis/viewtopic.php?f=17&t=288531
He had a problem similar to yours.
Best regards.
August 23rd, 2010 1:02am
If you don't want to install perl, you can build a small C#.net
application, see
http://adamkett.blogspot.com/2008/09/find-fix-255-file-folder-maxpath.html
-- Mike Burr
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 1:43am