in reply to check if it is a file or directory

---------------------------- Why this control fails?

while (my $name=readdir OF) {
    next if ( ($name =~ /^\./ )||(-f $name) );

That fails because you are testing the file name in the current directory instead of the $oldFolder directory.

the control on ".",".." is correct

Wrong: next if  $name =~ /^\./ will match any name that starts with '.', not just "." and "..".

Replies are listed 'Best First'.
Re^2: check if it is a file or directory
by saintex (Scribe) on Feb 26, 2010 at 15:11 UTC
    thank you for your answer... I understood that $name was the current directory and fixed by myself. Thank you for your precisation about . control. I'm not interesting in a correct control on hidden files, because in the directory of my interest there aren't, and I don't need to run that program outside that directory. But thank you for your answers