Add Dates to Automated Backup File Name

Using task scheduler, I'm trying to set up automated data back-ups from a VM

··· > server. I've got a code written that should work, and can set the task scheduler > to run this code automatically.  What I'd like to do is NOT overwrite the > file with each new back-up, though, and to end the name of each CSV export with > the date of the export. Is this possible? Here's the code I'm working with below > (in a .py file):
>
> import os
> os.system("java -jar \Users\skolka\Desktop\odk.jar --form_id nightingale_test > --storage_directory ~/Desktop --aggregate_url http://192.168.18.130 > --odk_username aggregate --odk_password aggregate --export_directory > C:/Users/skolka/Documents --export_filename nighttest.csv > --overwrite_csv_export")
>
> Thanks!

Hi there,

This is more of a Python question, but the trick is to generate the
timestamp in your script first.

import os
import datetime

now = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
command = "java -jar \Users\skolka\Desktop\odk.jar --form_id
nightingale_test --storage_directory ~/Desktop --aggregate_url
http://192.168.18.130 --odk_username aggregate --odk_password
aggregate --export_directory C:/Users/skolka/Documents
--export_filename nighttest-{}.csv --overwrite_csv_export".format(now)
os.system(command)

Yaw

··· On Thu, Feb 23, 2017 at 7:29 PM, wrote: > Using task scheduler, I'm trying to set up automated data back-ups from a VM >> server. I've got a code written that should work, and can set the task scheduler >> to run this code automatically.  What I'd like to do is NOT overwrite the >> file with each new back-up, though, and to end the name of each CSV export with >> the date of the export. Is this possible? Here's the code I'm working with below >> (in a .py file):
>>
>> import os
>> os.system("java -jar \Users\skolka\Desktop\odk.jar --form_id nightingale_test >> --storage_directory ~/Desktop --aggregate_url http://192.168.18.130 >> --odk_username aggregate --odk_password aggregate --export_directory >> C:/Users/skolka/Documents --export_filename nighttest.csv >> --overwrite_csv_export")
>>
>> Thanks! > > -- > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en > > --- > You received this message because you are subscribed to the Google Groups "ODK Community" group. > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.