We help IT Professionals succeed at work.

upload files via ftp and remove

Medium Priority
413 Views
Last Modified: 2012-08-13
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
Comment
Watch Question

CERTIFIED EXPERT

Commented:
>> 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?
CERTIFIED EXPERT

Commented:
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..
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.