Automated script to look for files in FTP Server location.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automated script to look for files in FTP Server location.
# 1  
Old 08-18-2011
Automated script to look for files in FTP Server location.

suppose one file comes in one sever location on MOnday.we have to write a script to automatically get that files and put it in different server location.

---------- Post updated at 10:28 AM ---------- Previous update was at 10:27 AM ----------

Please help me on this
# 2  
Old 08-18-2011
you can put this script in cron for automation

Code:
ftp -v -n $FTP_SERVER << EOF | tee $LOGFILE
user $FUSER $FPASS
cd $FILE_LOCATION
dir $FILE_TO_BE_FTPD
quit
EOF
   
grep $FILE_TO_BE_FTPD $LOGFILE
if [ $? -eq 0 ]
 then
  echo "FOUND FILE"
ftp -v -n $FTP_SERVER 
user $FUSER $FPASS
cd $FILE_LOCATION
get $FILE_TO_BE_FTPD
quit
EOF
else
     echo "File not found "
fi

# 3  
Old 08-19-2011
I think the third step is to upload the file to another server, which easily done by command put in ftp.

With jville's code, it should be easy for you now.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting local server file from automated FTP script

Hi, I want to delete a file on the local server, while connected to remote server through FTP. I am using the below code for this $FTP_CMD -v -n $HOST <<*! >> $LOGFILE 2>&1 user $USER $PASSWORD cd $DIR ... (11 Replies)
Discussion started by: jhilmil
11 Replies

2. Shell Programming and Scripting

script for to take files from FTP server to UNIX server and Unzipped that files

script for to take files from FTP server to UNIX server and Unzipped that files (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

3. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

4. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

5. Shell Programming and Scripting

Help needed with automated FTP script

Hi, Ok, i'm trying to automate sending a DB backup from a linux box to a remote Windows PC via FTP. I can connect, send the file and create a folder, however I require that the backups be differentiated by date. Here is what my script looks like: open *.*.*.* user username password lcd... (4 Replies)
Discussion started by: leimrod
4 Replies

6. Shell Programming and Scripting

Automated FTP from Unix to Active Directory Server

Automated Unix to Windows Active Directory FTP I have done many automated FTP scripts using the following logic: =============================== echo "Starting the FTP transfer..." { echo " open 192.168.1.100 user username password ascii put... (1 Reply)
Discussion started by: Cbish68
1 Replies

7. IP Networking

Automated ftp for Multiple files

I have seen the script posted yesterday for automated ftp Can we do some thing like ftp ing multiple files in one script Example input.txt has all files names to be ftped input.txt ------ a.tar b.ccp c.perl i need to ftp all the files present in input.txt i tried something like... (0 Replies)
Discussion started by: pbsrinivas
0 Replies

8. UNIX for Advanced & Expert Users

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

9. Programming

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

10. Shell Programming and Scripting

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies
Login or Register to Ask a Question