Forrest logo
back to the exiv2 tool

exiv2:tldr:5d11c

exiv2: Rename the file, prepending the date and time from metadata (not from the file timestamp).
$ exiv2 -r ${'%Y%m%d_%H%M%S_:basename:'} ${filename}
try on your machine

This command uses the exiv2 tool to modify an image's metadata. Here's how it breaks down:

  • exiv2: This is the command line utility used to manipulate image metadata in this case.
  • -r: This flag is used to specify a rename operation to be performed on the image file.
  • ${'%Y%m%d%H%M%S:basename:'}: This is a variable that specifies the new name for the image. It uses strftime formatting to represent the current date and time in the format "YYYYMMDD_HHMMSS", then adds the basename (name without the path or extension) of the original image to the end.
  • ${filename}: This is a variable that represents the original filename of the image.

In summary, this command renames an image by appending the current date and time (in the format "YYYYMMDD_HHMMSS") plus the original filename (without the path or extension).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the exiv2 tool