Question

Can we ftp specific files from a directory. And these specific files that needs to be transferred will be specified in config file.

Can we use a for loop once logged into ftp (in a script) for this purpose.

Will a normal ftp work when transferring files from Unix to win ftp server.

Thanks, Ravi

Was it helpful?

Solution

You can use straight shell. This assumes your login directory is /home/ravi Try this one time only:

  echo "machine serverB user ravi password ravipasswd" > /home/ravi/.netrc
  chmod 600 /home/ravi/.netrc

test that .netrc works - ftp serverB should log you straight in.

Shell script that reads config.file, which is just a list of files to send

while read fname 
do
   ftp serverB <<EOF
   get $fname
   bye
EOF         # leave the EOF  in column #1 of the script file
done < config.file

This gets file from serverB. Change get $fname to put $fname to send files from serverA to serverB

OTHER TIPS

That certainly is possible. You can transfeer files listed in some file by implementing a script using an ftp client (buildin or via calling a cli client). The protocol is system independant, therefore it is possible to transfer files between systems running different operating systems. There is only one catch: remember that MS-Windows uses a case insensitive file system, other systems differ in that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top