Win32::LongPath seems to be exactly what I need to deal with the files... but.. I can't get the rename function to work.
This with Perl 5.32 on Win10/64. Anyone have any experience with this module? Is it possible to contact the author?
my test code is very simple
#!/usr/bin/perl
use v5.10 ;
use strict;
use warnings ;
use Win32::LongPath ;
my $d = Win32::LongPath->new() ;
$d->opendirL(".") or die "Can't open directory: $!\n" ;
for my $file ($d->readdirL())
{ say $file ; }
$d->renameL("testfile.txt", "testedfile.txt") or die "didn't rename! $
+!";
exit ;
and when I run it I get
D:\Desktop\test>rename.pl
.
..
rename.pl
testfile.txt
didn't rename! at D:\Desktop\test\Onefile\test\rename.pl line 12.
and indeed the file wasn't renamed. I haven't a clue what I'm doing wrong
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.