Batch file to Get New Files Only through FTP

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Batch file to Get New Files Only through FTP
# 1  
Old 03-29-2009
Error Batch file to Get New Files Only through FTP

Hi there

I want to create a batch file which Get (mget) the newly added Files only from specific directory on UNIX server to specific folder on windows server using FTP, and this batch file will be scheduled on the windows server to run daily to load the new files (load the newly added files from the unix directory to the windows folder).
Urgent help plz

I have reached the following

1- The following is the batch file it contains the following:

Code:
ftp -n -s:ftp_import.txt 10.32.253.73
exit

2- The following is the text file which has the name "ftp_import.txt". it contains the following:

user <unix username>
<unix password>
lcd D:\(The path of source, where to get the files from unix server)
cd /home/The path of destination, where to put the files to windows server)
prompt
mget *.CSV
bye


Everything is running well

But still I want to modify this batch to get only the newly added CSV files, not all the files (*.CSV). this is now my only problem.

Last edited by Yogesh Sawant; 03-29-2009 at 01:57 PM.. Reason: added code tags
# 2  
Old 04-03-2009
A variation on the approach I use may meet your needs. The first call to FTP needs to do a DIR and save the result to the local disk. The script then parses that file to identifiy what files are new. The second call to FTP downloads specific files that were identified as new. I tend to do this sort of stuff with PERL instead of a batch file. Much better control that way.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

FTP batch file suddenly stopped working

Hello, we have a UNIX system the runs our business data. We have 4 users that use a particular batch command file to extract data for use in the Windows side of the fence: (despreg.bat) ftp ftp> open danapak (database name) connected to danapak ftp> user ccsb password ccsb ftp>... (29 Replies)
Discussion started by: Mick_Dundee
29 Replies

2. Shell Programming and Scripting

How to execute a batch file containing ftp commands??

hi, is there a way i can execute a batch file containing ftp commands like we execute sftp batch file. sftp -b batchfile user@server > output how to create a batch file for ftp executing command and how to run the batch file from a shell script? (2 Replies)
Discussion started by: Little
2 Replies

3. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

4. OS X (Apple)

Batch file to move video files and retain sub-directories

I have just purchased my first ever Apple computer - and am therefore new to UNIX also. I would like to create a simple "batch file" (apologies if this is the wrong terminology) to do the following: When I plug my camera into the MAC it automatically downloads photos and videos into a new... (1 Reply)
Discussion started by: mm0mss
1 Replies

5. UNIX for Dummies Questions & Answers

Comparing a batch of files to a test file

Hi I am writing a script to run a loop through a directory and run a diff on each file against my test file. I then want to time how long each file to process (not sure how time works), as well as how long all the files took as a whole to process. Here is my code #!/bin/bash #Old... (1 Reply)
Discussion started by: ladyAnne
1 Replies

6. Windows & DOS: Issues & Discussions

Batch file to Get New Files Only through FTP

Hi there I want to create a batch file which Get (mget) the newly added Files only, from specific directory on UNIX server to local folder on windows server through FTP, and this batch file will be scheduled to run daily to load the new files. help me plz :confused: (1 Reply)
Discussion started by: alsharq
1 Replies

7. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies

8. Windows & DOS: Issues & Discussions

Schedule a Batch file to delete files at particular intervals

Hi, I need to write a batch file/shell script that runs at specified intervals daily and deletes specified set of files. Can anyone pls help me with the code. Thanks, Indom. (6 Replies)
Discussion started by: Indom
6 Replies

9. UNIX for Dummies Questions & Answers

UNIX Batch FTP Command file

Hello, I am a UNIX newbie and this is my first posting. I need to create a batch command file to ftp from Sun/Solaris to AS/400. Here is an example file: ftp -d -i -n -v 172.28.16.22 pwd ls binary quit This is the result of executing the command file: Connected to... (10 Replies)
Discussion started by: pietro
10 Replies

10. UNIX for Dummies Questions & Answers

Batch files and FTP under Unix

Hey all, Does anyone know if Unix has an equivalent to a batch file? And if so, does it work the same way as a batch file under windows? AND, if you can answer that one, is it possible to run such a file under HP-UX and have it execute while in an FTP command line? What I need to do is... (4 Replies)
Discussion started by: ober5861
4 Replies
Login or Register to Ask a Question