windows - Copy work very well, while Move doesnt work at all. -
use file::copy; #variable directory work on $dir = "c:/projekty/perl/muzyka"; #variables used find mp3 files $dir_tmp = $dir."/*.mp3"; @files = glob( $dir_tmp ); #variable directory want create , put files $new_dir = "c:/projekty/perl/muzyka/new_dir"; #creating new directory mkdir ( $new_dir ) or print "mkdir problem";
till point allright. put loop:
foreach( @pliki ) { copy( $_, $new_dir) or print "copy problem"; }
or:
foreach( @pliki ) { move( $_, $new_dir) or print "move problem"; }
and problem is: copy works fine, move doesn't want job. works depends on modifications in code never in loop. simple code 1 line:
move($a, $b);
works perfectly. if use conditions or loops stops working if arguments (directories) seem ok (i checked them print function put in loop). why not working? there circumstances cause errors?
copy
, move
documented set $!
on error. it's check whether arguments expect them be. pay particular attention presence of newlines , trailing spaces.
move($_, $new_dir) or warn("can't move \"$_\" \"$new_dir\": $!\n");
Comments
Post a Comment