I was able to get the script to work using filenames similar to yours by this adding 2 lines after $file = $_:
$file =~ s/\=/\=g;
$file =~ s/\,/\,/g;
This just catches the '=' and ',' in the first half, and replaces those with '\=' and '\,' respectively. I had a similar issue as yours in the past and this is how I addressed it. You may also run into '.' and '..' erroring out, but the other files should move. I would also add rename ... or die syntax as was suggested by Aaron.
Hope this helps.
Comment on Re: Usig file name without backslash escape
<code>
#!/usr/bin/perl
use strict;
use warnings;
my $file;
opendir(DIR, "$newDir");
my @FILES= readdir(DIR);
closedir DIR;
foreach (@FILES)
{
$file = $_;
if ($file ne "..")
{
if ($file ne ".")
{
my $newFile = "/home/iphone/Maildir/ne
+w/$file";
my $curFile = "/home/iphone/Maildir/cu
+r/$file";
rename $newFile, $curFile or die $!;
}
}
}