
ajitbhaskaran
Novice
Jan 21, 2008, 3:22 AM
Post #1 of 4
(421 views)
|
|
unable to move file using system ()
|
Can't Post
|
|
hi, this is the script i am using to identify log files getting generated in a folder and if found shifted to a folder WIP( work in progress) , the script is working fine but the file is not getting moved to the new directory : #!/usr/bin/perl use strict; use warnings; my $list; system "ls *.log >> list.out" ; my @check_files=("list.out"); for my $check_file (@check_files) { if ( -f "$check_file" ) { open(LOG_FILE,"$check_file") || die "Cannot open $check_file"; while( my $line = <LOG_FILE> ) { my $thread_line=$line; print $thread_line; my $from = "'$thread_line'"; my $to = " ../WIP/'$thread_line'"; my $action= " mv $from $to "; #rename("$from", "$to"); system($action); } close(LOG_FILE); } } system " rm -f list.out "; ~ after execution it gives the error: ram.log mv: ram.log : cannot access: No such file or directory can anyone help please:
|