Reputation: 89
I'm trying for an ftp
script, that sends files in different folders within the same connection, but no luck with below script.
#!/bin/bash
HOST_NAME=host.server
username= user_name
passwd= password
remote = /path_to_remote/folder
local = /path_to_local/folder
folder=$1
pwd
ftp -in <<EOF
open $HOST_NAME
user $username $passwd
cd local/
lcd remote/
put a_filename_<timestamp>.txt
mkdir $remote/$folder
cd $remote/$folder
lcd $local/$folder
put b_filename.txt
close
bye
Adding to this, at run-time, is it possible to send only the latest files created in the last 10 minutes?
Upvotes: 0
Views: 1203
Reputation: 8406
Try this:
#!/bin/bash
HOST_NAME=host.server
username=user_name
passwd=password
remote=/path_to_remote/folder
local=/path_to_local/folder
folder="$1"
pwd
ftp -in <<EOF
open "$HOST_NAME"
user "$username" "$passwd"
cd local/
lcd remote/
put a_filename_<timestamp>.txt
mkdir "$remote/$folder"
cd "$remote/$folder"
lcd "$local/$folder"
put b_filename.txt
close
bye
EOF
Notes:
The shell doesn't allow spaces next to =
.
Quote variables.
OP code lacked closing EOF
.
I've left the <timestamp>
alone, that'd be a different Q.
Upvotes: 1