I am trying to create a loop to check to see if file exists on machinea before I ftp filea to machineb using unix commands. I need this loop to continue to check for filea on machinea until it exist and then ftp file to machineb.
man cron, sleep and find for starters. There are probably other threads dealing with this issue - try a keyword search in the forum (and other *nix forums on Tek-Tips) for ideas.
I would use cron, ssh (with no logins), sftp, find or if you know the path already ls is fine. I would use the output of ls -l or something also to get the file size and verify the file transferred properly.
Below is not tested, but should work; like suggested above the file may still being written to so it may be worth checking that the file size isn't growing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.