Hi,
i need to put files with current date at end from one server to another.
i.e. all the output files from below comand.
ls -ltr `date '+monthly_stats.sh%y%m%d'`
am using
mput `date '+monthly_stats.sh%y%m%d'`
but no files are transfered
Connected to gbdsnh18.hartfordlife.com.
220 gbdsnh18 FTP server ready.
331 Password required for tc20022.
230 User tc20022 logged in.
200 Type set to I.
250 CWD command successful.
Local directory now /nas/gbd_appdba/gbdsnh19
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 289 bytes in 0 transfers.
221-Thank you for using the FTP service on gbdsnh18.
221 Goodbye.
can someone please help me with this.
Thanks
sim
ftp, afaik, has a very limited command set that you can use ... try running the mput command with "mput monthly_stats.shYYMMDD" instead ...
Just Ice is correct: yes, there are commands like "ls" or "cd" inside "ftp", but these are not UNIX-commands at all. These are just subcommands inside "ftp". "ftp" is not just another shell, but an application program.
If you want to send a list of files which is more complicatedly constructed than via a single file glob (something like "mput *txt") you will have to preapre a list before and then use "ftp" inside a loop to transfer the files one by one. Another possibility is to prepare a command list for ftp and then use this document as input to ftp.
Still, i think you should forget ftp altogether and use some other tool, namely "scp". This is scriptable, it doesn't require you to put passwords inside scripts and it doesn't transmit passwords or files unencrypted over the network. "ftp" should NOT be used in any network environment any more.
I hope this helps.
bakunin
thanks for reply!
i tried the second option to use for loop and send filename one by one but it din work.
for i in `cat /nas/gbd_appdba/gbdsnh19/files'
mput i
done
I get the below output
Connected to gbdsnh18.hartfordlife.com.
220 gbdsnh18 FTP server ready.
331 Password required for tc20022.
230 User tc20022 logged in.
200 Type set to I.
250 CWD command successful.
Local directory now /nas/gbd_appdba/gbdsnh19
We only support non-print format, sorry.
i: No such file or directory
?Invalid command
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 289 bytes in 0 transfers.
221-Thank you for using the FTP service on gbdsnh18.
221 Goodbye.
can you please give me a example to use scp in such case. i will give a try for that.
Regards
Sid
Please read the above posts to understand why you don't have loops in ftp. Wishful thinking will not make them be wrong.
Also, please use one account, not an army of sockpuppets.
OK.
So to make this work I need to call ftp inside a for loop. Something like below
Ftp.sh
For I in ` cat files
Ftp
Mput
Done
Sorry am not in front of my lappy so just writing the logical code.
Please lenme know if an correct.