Avatar of krone20

asked on 

Create automated FTP batch script

I need to create a batch script that will ftp certain files from a Win2k3 server and put them on another server.  After the files are successfully put, I want to move them to an archived folder on the origin server.  I need to make sure that only the files that were ftp'd are moved.  Because there is the possibility that a new file could be added to the folder between the time the ftp completes and the move occurs right?  I would also like a log file generated to show each step, and any errors.  So the steps would be something like this:

1. Check to see if there are any files in C:\Output that have the Prefix TF*.  If there are no files then QUIT.
2. If files exist capture the file names.
3. Connect to ftpsite
4. Change directory.
5. Put all files captured in step 2.
6. Capture any errors in log file if FTP connection or put  is not successful.
7. Only if FTP is successful move just the files from step 2 to C:\Archive

I plan to schedule this job every hour as a scheduled task since files will be added to the outbox all throughout the day.

Thanks for the help
Server SoftwareWindows BatchMicrosoft DOS

Avatar of undefined
Last Comment

8/22/2022 - Mon