0

First I would like to say that I am terrible with scripting so this has been a true challenge for me. Any input would be great!

I would like to automate an sftp transfer every 24h. If I am lucky in the near future, I might be able to mount this share instead or at least have an ssh connection to use rsync or scp.

Ubuntu 10.04 In /res/output/ I will have new directories created all the time (with a counter added to the directory name) such as: /res/output/my_output_17/.pdf /res/output/my_output_17/addon/addon_1/.db (the directories "addon/addon_1/" always have that name so only the my_output_* will change name as well as the 2 files of interest. These should be dumped to a remote sftp directory, where we should save them int my_output_* directory that the script needs to create as well.

How can I do this? I want to make sure I only copy the non-transferred files. I would assume I need to populate some "db file" and make sure those files are skipped next time the script is running?

Thanks

0

I would use rsync it can copy over what is absent/different on remote.

eg rsync -av /res/output user@remotehost:/where/you/want/them

add that line to your crontab

rsync will need to login to your remote host, so you must also fix this if that doesn't work for you now. (can you ssh into your remote host without needing to supply a password ? are the public/private keys setup ?)

  • Since the OP mentions that his experience with scripting is weak, I think he expects a bit more detailled answer. This should be a comment maybe ? – mveroone Nov 14 '13 at 14:48
  • My Linux skill is strong, so don't worry:) Thanks for the suggestion. Since I am only interested in 2 files, one per directory, and not the other 100's of files and folders, so unfortunately this will not work. I have been using rsnapshot in the passed, but I feel it is an overkill, but maybe that is the way forward. – Mackis5 Nov 15 '13 at 7:37
  • There's always the this option, --include=PATTERN – X Tian Nov 15 '13 at 14:32

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.