Link to home
Start Free TrialLog in
Avatar of Coffinated
Coffinated

asked on

upload files via ftp and remove

I need to create a script that will upload files from W2k machine using ftp to another w2k8 r2 server running IIS. There are several TXT files that need to be uploaded and moved to another directory upon successful upload.

I have a batch script that will upload all *.TXT files via ftp and move all TXT files to another location after the 1st script finishes. What the script is missing is ability to distinguish if a file was successfully moved.

open 300.300.300.300
user
WebOrders
Password1
prompt
mput D:\Orders\*.TXT
quit

Open in new window


move D:\Orders\*.TXT D:\Uploaded

Open in new window


Appreciate any help
Avatar of knightEknight
knightEknight
Flag of United States of America image

>> What the script is missing is ability to distinguish if a file was successfully moved.

By this do you mean moved to the other server by FTP, or moved to the other folder on the same server by the move command?
also, I think you can combine the two scripts into one like this:


open 300.300.300.300
user
WebOrders
Password1
prompt
mput D:\Orders\*.TXT
!move D:\Orders\*.TXT D:\Uploaded
quit

Open in new window

right after the !Move command (Line #7) in above script by KnightKnight, You might consider adding a

!dir *.txt | find /i ".txt" && echo some files upload failed..


It will search for .txt files and if it finds any one of them ,will assume the upload failed..
ASKER CERTIFIED SOLUTION
Avatar of AlexPace
AlexPace
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial