pytr icon indicating copy to clipboard operation
pytr copied to clipboard

Customize timeformat in filenames

Open marvin226 opened this issue 2 years ago • 4 comments

Hello, thank you for your great work! pytr is a really helpful tool!

I think it would be great if we could format the datetime within the filename. My problem with the slash as time delimiter is that OneDrive cannot upload files containing a slash.

I just quickly looked into the code and thought one could parse the date and time to format it according to a user defined format, e.g. provided by another argument like --timeFormat with a default value of the existing behavior or an ISO format.

What do you think about it? If you need any support, I would be happy to help. Thank you!

marvin226 avatar May 17 '22 15:05 marvin226

I was wondering why your date contains slashes. Seems like the date from trade republic is different depending on your locale. I guess you use English locale. But I found a better way to get the date anyway, so I'll implement that. https://github.com/marzzzello/pytr/blob/1a798f1581ac1a7f273c60bc5eb6274ee8a97cf2/pytr/dl.py#L80-L81

marzzzello avatar May 17 '22 16:05 marzzzello

Thanks for your quick response. I have to clarify that the time contains slashes.

Here are two example filename's located in PATH/Abrechnungen:

  • 2019-11-21 22/38 Kauf TITLE.pdf
  • ...
  • 2022-04-01 12/05 TITLE.pdf

I wrote datetime because I thought about parsing your mentioned iso_date together with the time with datetime. But for sure one could just replace the slash with a colon too :)

marvin226 avatar May 17 '22 16:05 marvin226

Interesting. My files all use : instead of /

marzzzello avatar May 17 '22 16:05 marzzzello