Open philips opened 6 years ago
Hello @philips, thank you for the feature request and welcome to drive!
It's awesome to know that you use drive too! For sure, sounds like a plan, please go for it, this is exciting!
A problem with the current approach is that it is going to affect folders/directories too as it operators over all the items, perhaps just restrictive it to files might suffice but in later iterations I believe this would be a great idea to make more expressive.
Another idea that might help, is to perhaps introduce some simple renaming/rewriting templating as an option and that'll be run for to match each target file and folder. For example:
{{<fieldOfFile>}} {{matchOperator}} {{regex}} :: {{newlyFormedPath}} -> {{createdPath}}
where:
<ext> {{operator}} {{regex}} :: <name>.<ext> -> <fileId>.<ext>
where the detection would apply a matching template per file and then rename e.g
drive pull --rewrite '<ext> ~ jpe?g|png :: <name>.<ext> -> <fileId>.<ext>
For starters though, please feel free to roll out the patch that you suggested, let's get you unblocked and then later on iterate on the idea, what do you think?
I use
drive
to backup my Google Photos to an external SD card. This is possible because Google Photos has a feature to copy into Google Drive. Unfortunately due to how cameras name photos I get lots of name collisions doing this which continuously confusesdrive
when I use it as my backup tool.However, the filenames don't really matter to me. So, I would like to write a feature that is
drive pull -name-by-id
which would take the Google Drive ID of each file and append the proper extension. For example, if the directory looked like this:Then
drive pull -name-by-id
would create a directory structure like this:Any concerns if I write up a patch to do this?