drummerSupport icon indicating copy to clipboard operation
drummerSupport copied to clipboard

Suggested change to file name when downloading my files

Open jackbaty opened this issue 3 years ago • 10 comments

It's great that backups are as simple as choosing "Download my files...". I'm wondering if it would be possible, when creating the zip file, if it could be named something more descriptive than "myfiles.zip".

I'd love a date stamp in the filename so that it's easier to spot when the backup was made. Something like DATETIME-USERNAME.zip e.g. 202110120433-jackbaty.zip. Or even 202110120433-drummer-jackbaty.zip, just to be even more explicit.

Thanks. Obviously not a priority, but maybe for someday.

jackbaty avatar Oct 12 '21 08:10 jackbaty

You can script it yourself. If you hover over the "Download my files" you'll see a link with unique tokens in it. If you copy this link you can then use it elsewhere. image

I like python so I picked that, but I'm sure curl, wget, bash etc. can do it too:

import requests as re
import time

url = 'http://drummer.scripting.com/myfiles?oauth_token=<your-token>&oauth_token_secret=<your-secret>'
filename = time.strftime("%Y-%m-%d.%H_%M_%S") + "-drummer-thealexjj.zip"
file = re.get(url, allow_redirects=True)
open(filename, 'wb').write(file.content)

Output is 2021-10-26.11_32_50-drummer-thealexjj.zip file. You could then have the script unzip the file, git commit it and push to a private repo or whatever :beers:

alexjj avatar Oct 26 '21 11:10 alexjj

Thanks @alexjj. Nice solution! I may try something like this, but currently, all I'm doing is downloading and manually renaming, which isn't too big a stretch for something that happens once a day. The additional features you mention might make it worth it, though.

I still feel like the suggested modification to output naming would be generally useful for most people. Minor, but useful.

jackbaty avatar Oct 26 '21 12:10 jackbaty

Thanks @alexjj for pointing out the URL. Using Zapier I set up a scheduled backup to go off once a day to save the file to a Dropbox folder. The workflow recipe is "Schedule by Zapier" --> "Dropbox".

kenbooth avatar Oct 26 '21 13:10 kenbooth

I do this with a really long crontab entry. 😃

*/5 * * * * cd ~/DrummerOPMLBackup; / 
wget -O /tmp/my.zip http://drummer.scripting.com/myfiles?oauth_token=<your-token>&oauth_token_secret=<your-secret> ;  /
unzip -o /tmp/my.zip ; rm /tmp/my.zip ; git commit -am "`date`" ; git push

scotthansonde avatar Oct 26 '21 14:10 scotthansonde

@kenbooth @papascott those are both awesome! Thanks for sharing.

alexjj avatar Oct 26 '21 16:10 alexjj

@jackbaty You know what I just tried? I created Siri Shortcut. Two steps - Get URL contents and Save to Dropbox with today's date in path :-)

I just ask Siri now to back up my Drummer blog.

am1t avatar Oct 26 '21 16:10 am1t

I just ask Siri now to back up my Drummer blog.

@am1t Showoff! :). (These are all great solutions and y'all are going to make me want to retract my request!)

jackbaty avatar Oct 26 '21 18:10 jackbaty

@am1t Showoff! :)

Sorry, that wasn't the intention - but it just felt good to ask Siri to take backup :D

am1t avatar Oct 27 '21 00:10 am1t

I added a rule in Hazel -- my Downloads folder collection has a dozen or so. This one looks for "myfiles", renames it with a date and moves it to my backups folder. I like the idea of automating the backup in the first place -- haven't tackled that yet. For me it will probably be Keyboard Maestro since JavaScript is still out in the future somewhere...

dmatchett avatar Nov 25 '21 16:11 dmatchett

This is a support forum. That's all it's for. Don't post links to your products or websites.

scripting avatar Jan 07 '22 18:01 scripting