Operating System - Linux
1753789 Members
7310 Online
108799 Solutions
New Discussion

Transfer file for system A to system B using ftp

 
debian111
Regular Advisor

Transfer file for system A to system B using ftp

Hi all,

I have some questions if someone has time to answer. On sistem A using
ls -ltr | tail -1 I can find most recent file that is uploaded by other machines.
Now I need to transfer this file to another system ( windows ), say B.
I can do it using this:
ftp mmm.mmm.mmm.mmm
prompting me for user name and pass and I am there, and then
put file_name

but I do not know how do it using put from system B.
I need to tell system to transfer most recent file from system A to system B, using ftp. I can find most recent file and it is not problem.
Any help is welcome.
Best wishes and regards
1 REPLY 1
Zeev Schultz
Honored Contributor

Re: Transfer file for system A to system B using ftp

Ok,not a big deal as far as I see it. Use bash script to do the job,mark most recent file as $RECENT. And...

#!/bin/bash

$HOSTB=.... # host B IP
$RECENT=$(ls -ltr|tail -1|awk '{print $9}')

ftp<<**
#put here your ftp commands
open $HOSTB
put $RECENT
bye
**

Echo "Ftp transfer to $HOSTB of file: $RECENT was OK"

So computers don't think yet. At least not chess computers. - Seymour Cray