1

I have a bash script that cd to the right directory then uses the mput command to ftp all the files in the directory to a remote server, as below:

for from_dir in $DATE_LIST 
do
    cd ${FILE_LANDING_DIR}/deltas/${from_dir}
    ftp_files
done

ftp_files () {
    ftp -inv $HOST <<-EOF > $LOG_DIR/tempftplog
    user $USER $PASS 
    cd ${ID_LANDING_DIR}
    mput *
    bye 
    EOF
} 

I tried altering the ftp_files function to ftp only the .gz files in that directory by changing the line from mput * to mput *.gz but that did not work.

Can someone tell me how I can do this once in the ftp command?

0

2 Answers 2

0

Does mput *.gz not work? If not, try the ftp glob command first.

http://man.cx/ftp

-3

What about performing a directory search and piping it to the mput?

ls *.gz | mput

I cannot test this right now because Im not at a linux box so it might need to be tweaked to get it to work 100% correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.