how to move one file at a time to another folder.
I am trying to one file at a time for every 30 minutes.
So far the script is transferring all files at the same time and the source folder disappears afterwards. Could somebody help me out with this problem please.
I am trying to one file at a time for every 30 minutes.
So far the script is transferring all files at the same time and the source folder disappears afterwards. Could somebody help me out with this problem please.
Code:
#!/usr/bin/perl use warnings; #use strict; use Tie::File; use File::Copy; opendir(DIR, "/home/tibco/Susan/drop/") or die $!; @files = readdir(DIR); close(DIR); foreach (@files) { chomp($_[0]); my $old = "/home/tibco/Susan/drop/$_[0]"; my $new = "/home/tibco/AIS_FTP/3Com/inbound/Staging/"; move($old, $new); print "File Name: $_[0] moved to FTP - 30 mins for next upload.\n\n"; sleep 1800; print "Another is file uploading\n\n"; if (@files eq"") { print "Script ended all files are in FTP.\n\n"; exit; } }
Comment