I have a weird problem. I am trying to download a file from a ftp server to a different directory than what the bash script is running. If I do it manually everything works fine. I can connect type
get sampleFile.csv /path/to/directory/
Trying to put that in a bash script doesn't work. I get all the same output as doing it manaully
/ftp/sampleFile.csv 100% 384 0.4KB/s 00:01
but the file isn't in the directory or anywhere that I can find on my server. I have tried
sftp ***** << EOF
get sampleFile.csv /path/to/directory/
quit
EOF
and
cd /path/to/directory/
sftp ***** << EOF
get sampleFile.csv
quit
EOF
and
sftp ***** << EOF
lcd /path/to/directory
get sampleFile.csv
quit
EOF
All of these work doing it manually.
The only thing that works is
sftp ***** << EOF
get sampleFile.csv
quit
EOF
This puts the file in the same directory the bash script is in and it shows up. Any ideas whats going on?
cd
orchdir
earlier in the script perhaps? – roaima Jul 9 '20 at 7:46