Solved

I need a batch that move and FTP files on hourly bases

Posted on 2014-11-28
7
227 Views
Last Modified: 2014-12-05
Hi,

I have two types of files that names like :

count_of_S_20141110.txt
count_of_S_20141111.txt

and other

count_of_g_20141110.txt
count_of_g_20141111.txt

what i'm looking for is a batch file to run every hour and:
1- FTP them to some remote location
2- move them from that current folder

thanks for the help
0
Comment
Question by:hi4ppl
7 Comments
 
LVL 24

Expert Comment

by:NVIT
ID: 40471330
What OS?
a batch file to run every hour
You can use the Task Scheduler for this.

move them from that current folder
Move to where?
0
 
LVL 1

Author Comment

by:hi4ppl
ID: 40471350
Hi,

current folder :

D:/data/

move to

D:/backup/s ** for S files
D:/backup/g ** for G files

regards
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40471357
so is this ftp as in the question, or just a mapped drive?

if it is a mapped drive then a unc path \\server\share would be best as the drive mapping wouldnt be available to a scheduled task.

Is there any remaining involved or just look for those files and move them to the other location?

is there any chance they could still be being written to when the script runs? If there is would  suggest the other process could flag completion or only rename the file when it has finished.

If you did this process manually how do you do it?

Steve
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 24

Accepted Solution

by:
NVIT earned 500 total points
ID: 40471381
hi4ppl,

Will your .txt files always have unique names that won't conflict with other files at the ftp and D:/backup ends?
If not, you either have to delete or rename them before sending them.

Do you need ftp examples? See Steve's examples at http://scripts.dragon-it.co.uk/links/batch-ftp-scripting

Assuming the .txt files are always unique, your batch files could look like...

cd d:\data

( Do ftp stuff here )

move count_of_S_*.txt d:\backup\s
move count_of_G_*.txt d:\backup\g

Open in new window


For the task scheduler GUI, the steps differ a bit, depending on the OS.

If you want to make and control the task via the command line:

XP: http://www.windowsnetworking.com/kbase/WindowsTips/WindowsXP/AdminTips/Utilities/XPschtaskscommandlineutilityreplacesAT.exe.html

Windows 7: http://technet.microsoft.com/en-us/magazine/ff356867.aspx

[Steve: edited to change link to permanent one for script site]
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 40472892
There is an extension called ftpuse, which works like net use but for FTP, and can simplify access if you need to do more than just push files into FTP. Checking for existence, for example.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 40473159
@Qlemo - that sounds potentially useful, put in the toolbox :-)
0
 
LVL 24

Expert Comment

by:NVIT
ID: 40483411
hi4ppl... Thanks for the update. I'm glad we could help.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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