ftp script to get files periodically


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp script to get files periodically
# 1  
Old 04-13-2009
ftp script to get files periodically

Hi Folks Interesting question hope u get the ans:

I have to ftp a file ABC(Timestamp) to server XYZ

My script should be doing the every 2 hours.

after the transfer I need to confirm whether the file ABC(timestamp) got transfer properly or not.

My concern is after the "put ABC" comand in the FTP'd server how would I get the latest file name from the server please discribe your inovative ideas and logics ASAP.

One more clue on every file I have a trailer say TRAILER_END.

Like wise I have 10 files in the interval of 2 hours!!! with ABC_time_stampSmilie
# 2  
Old 04-13-2009
Also can any one tell me how do I use the comand in FTP server:

>ftp server112
Connected to server112.com.
220 server112 FTP server () ready.
Name (daushp01:ibatch):
331 Password required for user
Password:
230 User logged in.
ftp> cd /client/work/in/progress
250 CWD command successful.
ftp> tail file_name
?Invalid command

how do I do the basic comands in the ftp'd server?

I want to use comands like:

tail file_name
head file_name
cp file_name file_simple

etc
etc
.
.
.
# 3  
Old 04-19-2009
try `help'

just tipe in the ftp prompt :

help

and you will get a list of the available commands ;

- btw commands like "head", "tail" are not available ... that would be the role of `ssh' ;

good luck, and success !

alexandre botao
# 4  
Old 04-19-2009
Please state the Operating System of the source and destination.

Last edited by methyl; 04-19-2009 at 09:10 PM.. Reason: Typo
# 5  
Old 04-19-2009
BTW (1). The only way I have found to verify an FTP is to transfer the file back with a new name and then compare before and after checksums (man cksum).
Your attempts to run unix commands such as "tail" "cp" etc. will not work with ftp (as botao describes).
BTW (2): If you are copying unix-unix there are better methods than ftp.
# 6  
Old 04-19-2009
You should be able to run the command on the local server by using the '!' sign:

>ftp server112
Connected to server112.com.
220 server112 FTP server () ready.
Name (daushp01:ibatch):
331 Password required for user
Password:
230 User logged in.
ftp> cd /client/work/in/progress
250 CWD command successful.
ftp> tail file_name
?Invalid command
>!tail file_name
This is a test on local machine!

I used the '!' sign all the time to remove files on local machine after I ftp them over...or to do an ls (!ls)
# 7  
Old 04-20-2009
Methly:

BTW 2 your second option feel good to me and yes im coping from unix to unix could you please suggest on that please
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP Script for Multiple Files of Same Name

Hello! I'm having a bit of trouble coming up with a script that can connect to 3 different log boxes and pull down files for that day into a single directory, where the files will all have the same name as per: stats_websites_20150801010000-20150801015959.csv.gz... (2 Replies)
Discussion started by: Cludgie
2 Replies

2. Shell Programming and Scripting

Download files every one second using ftp script

Our main Server "Srv1" is used to generate text files based on specified criteria and it is also connected to two clients (pc1 and pc2) which are responsible for getting the files from Srv1 as it follows: 1. pc1 ( which represents my UNIX machine ) uses shell script to copy the files from Srv1 2.... (3 Replies)
Discussion started by: arm
3 Replies

3. Shell Programming and Scripting

Help with script periodically pushing files from one host to another

Dear all, I would like to write a script to push periodically some downloaded files from one host to another box. Basically, I have host A downloading files. When those files are downloaded they are moved automatically to a directory called: /home/user_A/downloaded, still on host A. Then... (1 Reply)
Discussion started by: freddie50
1 Replies

4. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

5. Shell Programming and Scripting

ftp script for transfering files

Hi, I am new to shell scripting,and i was planning to write a script that will FTP files to destination folder. All configuration should be done through a properties files.I was planning that All configuration should be done through a properties files. and finally the output should be... (0 Replies)
Discussion started by: rahul125
0 Replies

6. AIX

script to ftp recent changed files

I am trying to write a script to ftp all files/directories changed in a 24hour period to another AIX server. I have wrote a script to generate a list of all files changed within a 24 hour period but dont know how to then ftp these to another server. How do incorporate ftp into this script? ... (2 Replies)
Discussion started by: RApds
2 Replies

7. Shell Programming and Scripting

Script for FTP (transfer only new files)

Hi everybody, I just want to transfer files with FTP (mget and mput). The problem is that I dont want to overwrite any existing files and don't want to transfer them again (e.g. using the rename-function). So I only want to transfer new files with mget and mput. My first idea was to create... (3 Replies)
Discussion started by: inoxx
3 Replies

8. Shell Programming and Scripting

script to send command periodically to remote server

Hi, I'm wondering if there's a way to send a command periodically to remote server through a script. Right now I have this: keepLooping=1 ssh user@domain while (( keepLooping == 1 )) do echo a sleep 3 done but what this does is ssh to the server, and only when the connection is... (2 Replies)
Discussion started by: sayeo
2 Replies

9. Shell Programming and Scripting

script working periodically

We have a strange problem that started happening a few months ago. We have a unix script being called from within a microfocus cobol program using the call "SYSTEM" cobol command. The problem is sometimes the script will run, sometimes it wont - without us changing anything! The other strange... (1 Reply)
Discussion started by: lf398
1 Replies
Login or Register to Ask a Question