Solved

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

Posted on 2014-11-28
7
217 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 23

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 23

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 68

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 23

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now