I am trying to use ftp to transfer the contents of 2 directories on my local machine (PI-jessie) to a website. The script successfully changes to the first local & remote directory and uploads the files. However the files in the second local are transferred to the first remote i.e. all files end up in the first named remote directory ('Data' rather than 'Plots').

ftp -p -n -v $HOST << EOT
lcd /home/pi/InfraSound/Data/2018
cd StarFishPrime/projects/infrasound/Data
mput *.mseed
cd StarFishPrime/projects/infrasound/Plots
lcd /home/pi/InfraSound/Plots
mput *.svg
  • 1
    Does the secord cd actually succeed? I don't think it does as the path is relative to the current location. You may want cd ../Plots – Kusalananda Mar 10 '18 at 10:47

Once you have changed to the remote directory StarFishPrime/projects/infrasound/Data, the second cd will try to change directory to StarFishPrime/projects/infrasound/Data/StarFishPrime/projects/infrasound/Plots (relative to the initial directory at the start of the ftp session).

This will likely fail and the directory remains unchanged.

You may want

cd ../Plots

or use an absolute path.

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.