linux - Shell Script - SFTP -> If copied, remove? -
iam trying copy textfiles shellscript on sftp. wrote script job.
#!/bin/bash host='servername' user='username' sftp -b - ${user}@${host} << eofftp /files/*.txt /tmp/ftpfiles/ rm /files/*.txt quit eofftp
before remove textfiles on ftp, want make sure, copied files without errors. how can this? use ssh-keys login.
task is: copy textfiles on , on make sure, not same ones... (thats why use remove...)
maybe move them on ftp? copy , move /files/copied ?
actually, rsync ideal this:
rsync --remove-source-files ${user}@${host}:/files/*.txt /tmp/ftpfiles/
Comments
Post a Comment