6

I've been downloading videos with youtube-dl using upload_date in the name of the file. This puts the date in YYYYMMDD format in the name file, but I will find more convenient if I could store them in something like:

  • YYYY-MM-DD
  • DD-MM-YYYY

I know youtube-dl does not provide that option, but is there any other way of doing this (either on Linux or Windows)? The only I can think of is mass renaming with mmv after downloading every file.

Right now I use the output template:

"%(upload_date)s-%(title)s.%(ext)s"
1
  • 1
    Thanks for the tip how to add date at the beginning of the filename! – pbies Dec 28 '20 at 0:58
2

With the perl-flavoured rename command, you could write:

rename 's/^(\d{4})(\d{2})(\d{2})/$1-$2-$3/' [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-*

I recommend you use the ISO standard YYYY-MM-DD date format: it is unambiguous and it sorts the same lexically and chronologically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.