?
Solved

upload files via ftp and remove

Posted on 2011-04-26
4
Medium Priority
?
365 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
0
Comment
Question by:Coffinated
  • 2
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 35469760
>> 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?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 35469780
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

0
 
LVL 8

Expert Comment

by:subhashchy
ID: 35470342
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..
0
 
LVL 16

Accepted Solution

by:
AlexPace earned 2000 total points
ID: 35476973
Archiving uploaded files could be easily automated in Robo-FTP with the following script:
WORKINGDIR "D:\Orders"
ARCHIVEDIR "D:\Uploaded"
FTPLOGON "300.300.300.300" /user="WebOrders" /pw="Password1" 
SENDFILE "*.txt" /archive
FTPLOGOFF
EXIT

Open in new window

This script uploads all the text files in the Orders folder and each file that is successfully uploaded is moved to the Uploaded folder.  Any file that fails to upload will not be moved into the archive.  If you wanted to get fancy about it you could make it send you an email when the upload fails or make it retry X number of times, or run on a schedule or whatever.  Robo-FTP was made specifically for automating repeated file transfers so it gives you a lot of options but it isn't freeware.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question