Bob said:
I also did a test with Perl scripting, and was
able to create a 259 character long file name, which
I couldn't delete from explorer. (I could delete a 258
character fule file/path name, but not 259.)
Perl has a rename function, and using that function,
I could change the name of the 259 character file to
something shorter, after which the test file I created
could be deleted.
I got my copy of Perl here.
http://downloads.activestate.com/Ac...ActivePerl-5.12.2.1202-MSWin32-x86-293621.msi
This is the contents of my rename.pl file. This is just
to test out a few ideas in Perl.
When Perl is installed, programs ending in .pl are
executable from the Command Prompt window. Opening
a command prompt, and cd'ing to the test directory,
I could run a script like this. This is my prototype,
which takes no arguments, because I'm hard-coding any
file names I want to test with.
************************************** rename.pl ****************
printf("this is a test\n");
#
http://www.tutorialspoint.com/perl/perl_files.htm
#rename("one", "two"); I tested a basic rename would work and it did.
# This chunk creates a long file name. The concatenated string is
# a short hand form, to save typing. The $b string variable, holds
# a less than ten character string, so you can find out exactly how
# many characters the file system will take. The "open" command tries
# to create a file, and if the create operation fails, the program
# exits.
$a = "0123456789";
$b = $a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a.$a ;
$b = $b . "0123456.txt" ;
open(OUT, ">>$b") || die("Cannot create file");
close(OUT);
# On my Win2K virtualpc test OS, I could get a total 259 character
# path/filename.
# This prints out the filename. I'm working relative to the
# current working directory, so I glue the working directory name
# to the filename I'm using.
use Cwd;
$c = getcwd ;
printf("%s/%s\n", $c , $b );
$c = $c . "/" . $b ;
printf("Length of full file path is %d\n", length $c );
# When the file can no longer be erased, I uncomment this
# line and it renames the long filename, back to a ten character
# file name, for easy deleting in Explorer. If I run the script
# as is, the file name ends up as "0123456789". Place the # in
# front of this line, to see the 259 character filename in the folder.
rename( $b , $a );
exit(0);
***************************************************************
Anyway, if the original poster gets bored, it's possible a
scripting language may provide a good enough compromise
between programming skills and flexibility, to do a rename
operation. If you had only one file to fix, the filenames
could be hard coded in the script and then run. I don't know
enough Perl to do that. The only reason I used Perl, is I bought
two Perl books about ten years ago - and now I got my money's
worth.
The thing is, I don't know what tool is the "most powerful" at
fixing this problem. If Windows had two ways to refer to a file
like in a Unix environment (inode and file name), you might have
more options to fix this problem. As far as I know, all Windows
has is the file name. (I figured booting a Linux LiveCD and
working the problem, would be cheating.)
Paul