Solved

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

Posted on 2014-11-28
7
231 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…

749 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