andreafabrizi / Dropbox-Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.56k stars 1.08k forks source link

Keep local timestamp #554

Open Offerel opened 2 years ago

Offerel commented 2 years ago

Is there a way to keep the local timestamp of a file, when uploading this to Dropbox?

I try to use you script as to make some sort of offsite Backup of my Markdown Notes. Mostly, i use the notes sorted by date to keep an eye on the latest changes. Often the newest edited file, has the most important information.

But when i upload it to Dropbox, all the files become the timestamp from today, because the folder on the dropbox side is empty, since this is the first upload. Im using the following piece of bash script in a cronjob:

notespath="/path/to/my/Notes/"
for file in "$notespath"*; do
"/path/to/dropbox_uploader.sh" -q upload "$file" /Backup/Notes/ 2> >( while read line; do error_report 2 "Dropbox Upload: ${line}" $option; done )
done

error_report is some sort of error handler, which send me a mail, if some error occurs.