I'm a unix novice and a rusty one at that. I'm writing a unix shell script that is using an sftp batch file to copy a bunch of individual files from one server to another. Wildcards will not work in this situation. So my script looks something like this:
#!/bin/bash
echo "Starting..."
USER="user"
DEST="server"
sftp -b batch.txt $USER@$DEST
echo "Complete."
And my batch file looks something like this:
cd /Data/in
lcd /Data/in
put file1
put file5
put file9
...
bye
As long as all of the files are present in the source directory, this all works fine. My issue is that if any of the 170 or so files are missing from the source directory the whole script will end with a "file not found" error. I'd like it to just keep going, ignoring any "file not found" issues. Is there a quick way to do this? Or am I looking at writing code to check if every file in this list exists before I begin the sftp?
Also, as a side question, would it be better for me to use mput in this situation?
Thanks for any help.
Bobby