![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding Multiple Lines to Multiple Files | dayinthelife | Shell Programming and Scripting | 2 | 06-04-2008 11:50 AM |
| Multiple search in multiple files | maxvirrozeito | Shell Programming and Scripting | 2 | 12-13-2007 01:32 PM |
| Dynamically ftp'ing a file | pyaranoid | UNIX for Advanced & Expert Users | 0 | 09-02-2007 07:34 AM |
| FTP'ing files with filenames in mail messege | berlin_germany | Shell Programming and Scripting | 1 | 11-27-2006 05:07 PM |
| Searching multiple files with multiple expressions | Anahka | Shell Programming and Scripting | 6 | 01-07-2004 06:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help in FTP'ing multiple files
Hi,
I have written the following FTP script to get the multiple files from remote server to local server. My problem is that 'mget *' is not working in the script. I also tried with 'mget *.txt', 'mget *.*' etc. without any success. It do not copy any file to local server. In the script, Prompt is set off. However, when I try doing it manually, it works. Don't know, where the problem lies. My code is like, $LOGIN=user $FTPPASS=password mkdir ftp`date '+%Y%m%d'` cd ftp`date '+%Y%m%d'` `ftp -vin <<- END_INPUT > $LOG/ftp_files.log 2>&1 open $DEVICE user $LOGIN $FTPPASS cd $PICKUP mget *.txt quit END_INPUT` |
|
||||
|
Thanks a lot Srikanthus2002. I did as you mentioned and it's working fine when I try to FTP files in a directory "ftp`date '+%Y%m%d'`" on local server. But, when I try to ftp the same files to one more directory "ftp_verify`date '+%Y%m%d'`" on the local server using 'lcd' command, it do not copy anything there. Actually, to check wether files are FTP'ed correctly on local server, I need to use a verification logic in my script. And to do that I copy files from remote server in 2 different directories on local server and then compare them using 'diff' command in the script. Then after verification I delete the verification directory "ftp_verify`date '+%Y%m%d'`". Can you please explain, why it's not copying files in "ftp_verify`date '+%Y%m%d'`" directory? My scripts is like:
#!/bin/ksh HOME1=/home/sri echo " 1" cd /home mkdir ftp`date '+%Y%m%d'` mkdir ftp_verify`date '+%Y%m%d'` cd ftp`date '+%Y%m%d'` ftp -n server_ip << END_INPUT > /tmp/ftp_files.log 2>&1 user username password cd $HOME1 prompt mget *.txt # copies files correctly lcd /tmp/ftp_verify`date '+%Y%m%d'` mget *.txt # Do not copy anything bye END_INPUT cd /home diff -w ftp`date '+%Y%m%d'` ftp_verify`date '+%Y%m%d'` > /dev/null if [ $? -ne 0 ] then echo "Error: Files are not successfully FTP'd" mailx -r user@vrfai030.private.annonymous.com -s \'"Files FTP failed'" user@annonymous.com < /tmp/ftp_fail.msg exit 1 rm -r ftp_verify`date '+%Y%m%d'` fi exit 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|