Raj
Raj

Reputation: 91

move file within FTP server using shell script

i run into a following scenario

  1. download the file from FTP server to local and process it

Ex: FTPSERVER/dir/file_name => /data/process/file_name

  1. After processing, move the file in FTP server to its archive folder

Ex: FTPSERVER/dir/file_name => FTPSERVER/dir/archive/file_name

I have to do this using shell script. I have completed the first part using

ncftpget -u $USER -p $PASS $HOST/DIR/$FILENAME

I dont know how to do the second part.. which is moving the file into archive DIR of FTP server...

could someone help me on this...

Thanks in advance...

Upvotes: 0

Views: 1560

Answers (1)

Armali
Armali

Reputation: 19375

ftp -n $HOST <<EOF
user $USER $PASS
rename DIR/$FILENAME DIR/ARCHIVE/$FILENAME
EOF

Upvotes: 1

Related Questions