Solved

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

Posted on 2014-11-28
7
210 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

12 Experts available now in Live!

Get 1:1 Help Now