How can I rename files to match their EXIF “created date”?
I have around 3000 jpeg photos all with names like "DSC_0596
". The metadata has the date the photo was created, which would be much more useful.
Is there a way to extract the date from the metadata and add it to the photo name?
metadata file-management filenames date
New contributor
add a comment |
I have around 3000 jpeg photos all with names like "DSC_0596
". The metadata has the date the photo was created, which would be much more useful.
Is there a way to extract the date from the metadata and add it to the photo name?
metadata file-management filenames date
New contributor
add a comment |
I have around 3000 jpeg photos all with names like "DSC_0596
". The metadata has the date the photo was created, which would be much more useful.
Is there a way to extract the date from the metadata and add it to the photo name?
metadata file-management filenames date
New contributor
I have around 3000 jpeg photos all with names like "DSC_0596
". The metadata has the date the photo was created, which would be much more useful.
Is there a way to extract the date from the metadata and add it to the photo name?
metadata file-management filenames date
metadata file-management filenames date
New contributor
New contributor
edited 6 hours ago
mattdm
118k38348639
118k38348639
New contributor
asked 19 hours ago
Simon Meade
162
162
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
ExifTool is pretty much the Swiss army chainsaw for doing these kinds of things. It has a steep learning curve, but once you're over it, the kind of renaming you're after is a snap:
exiftool -d '%Y%m%d-%H%M%%-03.c.%%e' '-filename<CreateDate' .
The -d
switch tells ExifTool to format dates according to the next argument's pattern. The pattern contains date format codes that fill in various bits and pieces from the date. This would rename a file taken today at 17:34 to 20181226-17:34-000.nef
. The three zeros after the time are a copy number put there by %%-03.c
in the date format. I'll explain why that's important in a minute.
The next argument tells ExifTool to change the filename to whatever is in the CreateDate
field in the EXIF using the date format specified earlier.
Finally, the .
is the path of the directory where you want to operate. You can also specify individual images if you want.
About the copy number: This is an important thing to put in your filenames because many cameras don't provide fractional seconds in their timestamps. If you had multiple files created during the same second, each successive rename would overwrite the last file and all you'd get is the last one. When picking a name, ExifTool will keep incrementing the copy number until it finds a filename that doesn't exist and rename the file to that. Note that this does not weed out duplicates. If you use this method to copy images from a card into some other directory and then run it again on the same set of images, you will end up with identical files numbered 000
and 001
.
add a comment |
For simple things where the flexibility, power, and complication of ExifTool aren't necessary, I like to use the tool jhead. It's a command-line tool available for Linux, Mac, and Windows.
jhead -n%Y%m%d-%H%M%S *.jpg
will automatically rename all files ending in .jpg
in the current directory to a format like 20181226-111141.jpg
. You can use %f
to also include the original filename (without extension). So, for example:
jhead -n%Y%m%d-%f *.jpg
... which gives the date (and not the time) and the original filename, like 20181226-DSC_0596.jpg
.
Note that there is logic to attempt to not rename files which already are mostly digits, which keeps the command from accidentally acting twice. Use -nf
instead of just -n
to override this. There is also logic to automatically add an incrementing trailing digit if the target filename already exists.
Also, I usually add -autorot
and -ft
to the command line, to match image orientation to the camera's rotation sensor and to make the file time match the exif time.
1
The problem withjhead
is it requireslibjpeg-turbo-progs
, so it will conflict with packages that requirelibjpeg-progs
.
– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "61"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fphoto.stackexchange.com%2fquestions%2f103767%2fhow-can-i-rename-files-to-match-their-exif-created-date%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
ExifTool is pretty much the Swiss army chainsaw for doing these kinds of things. It has a steep learning curve, but once you're over it, the kind of renaming you're after is a snap:
exiftool -d '%Y%m%d-%H%M%%-03.c.%%e' '-filename<CreateDate' .
The -d
switch tells ExifTool to format dates according to the next argument's pattern. The pattern contains date format codes that fill in various bits and pieces from the date. This would rename a file taken today at 17:34 to 20181226-17:34-000.nef
. The three zeros after the time are a copy number put there by %%-03.c
in the date format. I'll explain why that's important in a minute.
The next argument tells ExifTool to change the filename to whatever is in the CreateDate
field in the EXIF using the date format specified earlier.
Finally, the .
is the path of the directory where you want to operate. You can also specify individual images if you want.
About the copy number: This is an important thing to put in your filenames because many cameras don't provide fractional seconds in their timestamps. If you had multiple files created during the same second, each successive rename would overwrite the last file and all you'd get is the last one. When picking a name, ExifTool will keep incrementing the copy number until it finds a filename that doesn't exist and rename the file to that. Note that this does not weed out duplicates. If you use this method to copy images from a card into some other directory and then run it again on the same set of images, you will end up with identical files numbered 000
and 001
.
add a comment |
ExifTool is pretty much the Swiss army chainsaw for doing these kinds of things. It has a steep learning curve, but once you're over it, the kind of renaming you're after is a snap:
exiftool -d '%Y%m%d-%H%M%%-03.c.%%e' '-filename<CreateDate' .
The -d
switch tells ExifTool to format dates according to the next argument's pattern. The pattern contains date format codes that fill in various bits and pieces from the date. This would rename a file taken today at 17:34 to 20181226-17:34-000.nef
. The three zeros after the time are a copy number put there by %%-03.c
in the date format. I'll explain why that's important in a minute.
The next argument tells ExifTool to change the filename to whatever is in the CreateDate
field in the EXIF using the date format specified earlier.
Finally, the .
is the path of the directory where you want to operate. You can also specify individual images if you want.
About the copy number: This is an important thing to put in your filenames because many cameras don't provide fractional seconds in their timestamps. If you had multiple files created during the same second, each successive rename would overwrite the last file and all you'd get is the last one. When picking a name, ExifTool will keep incrementing the copy number until it finds a filename that doesn't exist and rename the file to that. Note that this does not weed out duplicates. If you use this method to copy images from a card into some other directory and then run it again on the same set of images, you will end up with identical files numbered 000
and 001
.
add a comment |
ExifTool is pretty much the Swiss army chainsaw for doing these kinds of things. It has a steep learning curve, but once you're over it, the kind of renaming you're after is a snap:
exiftool -d '%Y%m%d-%H%M%%-03.c.%%e' '-filename<CreateDate' .
The -d
switch tells ExifTool to format dates according to the next argument's pattern. The pattern contains date format codes that fill in various bits and pieces from the date. This would rename a file taken today at 17:34 to 20181226-17:34-000.nef
. The three zeros after the time are a copy number put there by %%-03.c
in the date format. I'll explain why that's important in a minute.
The next argument tells ExifTool to change the filename to whatever is in the CreateDate
field in the EXIF using the date format specified earlier.
Finally, the .
is the path of the directory where you want to operate. You can also specify individual images if you want.
About the copy number: This is an important thing to put in your filenames because many cameras don't provide fractional seconds in their timestamps. If you had multiple files created during the same second, each successive rename would overwrite the last file and all you'd get is the last one. When picking a name, ExifTool will keep incrementing the copy number until it finds a filename that doesn't exist and rename the file to that. Note that this does not weed out duplicates. If you use this method to copy images from a card into some other directory and then run it again on the same set of images, you will end up with identical files numbered 000
and 001
.
ExifTool is pretty much the Swiss army chainsaw for doing these kinds of things. It has a steep learning curve, but once you're over it, the kind of renaming you're after is a snap:
exiftool -d '%Y%m%d-%H%M%%-03.c.%%e' '-filename<CreateDate' .
The -d
switch tells ExifTool to format dates according to the next argument's pattern. The pattern contains date format codes that fill in various bits and pieces from the date. This would rename a file taken today at 17:34 to 20181226-17:34-000.nef
. The three zeros after the time are a copy number put there by %%-03.c
in the date format. I'll explain why that's important in a minute.
The next argument tells ExifTool to change the filename to whatever is in the CreateDate
field in the EXIF using the date format specified earlier.
Finally, the .
is the path of the directory where you want to operate. You can also specify individual images if you want.
About the copy number: This is an important thing to put in your filenames because many cameras don't provide fractional seconds in their timestamps. If you had multiple files created during the same second, each successive rename would overwrite the last file and all you'd get is the last one. When picking a name, ExifTool will keep incrementing the copy number until it finds a filename that doesn't exist and rename the file to that. Note that this does not weed out duplicates. If you use this method to copy images from a card into some other directory and then run it again on the same set of images, you will end up with identical files numbered 000
and 001
.
answered 7 hours ago
Blrfl
4,6761322
4,6761322
add a comment |
add a comment |
For simple things where the flexibility, power, and complication of ExifTool aren't necessary, I like to use the tool jhead. It's a command-line tool available for Linux, Mac, and Windows.
jhead -n%Y%m%d-%H%M%S *.jpg
will automatically rename all files ending in .jpg
in the current directory to a format like 20181226-111141.jpg
. You can use %f
to also include the original filename (without extension). So, for example:
jhead -n%Y%m%d-%f *.jpg
... which gives the date (and not the time) and the original filename, like 20181226-DSC_0596.jpg
.
Note that there is logic to attempt to not rename files which already are mostly digits, which keeps the command from accidentally acting twice. Use -nf
instead of just -n
to override this. There is also logic to automatically add an incrementing trailing digit if the target filename already exists.
Also, I usually add -autorot
and -ft
to the command line, to match image orientation to the camera's rotation sensor and to make the file time match the exif time.
1
The problem withjhead
is it requireslibjpeg-turbo-progs
, so it will conflict with packages that requirelibjpeg-progs
.
– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
add a comment |
For simple things where the flexibility, power, and complication of ExifTool aren't necessary, I like to use the tool jhead. It's a command-line tool available for Linux, Mac, and Windows.
jhead -n%Y%m%d-%H%M%S *.jpg
will automatically rename all files ending in .jpg
in the current directory to a format like 20181226-111141.jpg
. You can use %f
to also include the original filename (without extension). So, for example:
jhead -n%Y%m%d-%f *.jpg
... which gives the date (and not the time) and the original filename, like 20181226-DSC_0596.jpg
.
Note that there is logic to attempt to not rename files which already are mostly digits, which keeps the command from accidentally acting twice. Use -nf
instead of just -n
to override this. There is also logic to automatically add an incrementing trailing digit if the target filename already exists.
Also, I usually add -autorot
and -ft
to the command line, to match image orientation to the camera's rotation sensor and to make the file time match the exif time.
1
The problem withjhead
is it requireslibjpeg-turbo-progs
, so it will conflict with packages that requirelibjpeg-progs
.
– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
add a comment |
For simple things where the flexibility, power, and complication of ExifTool aren't necessary, I like to use the tool jhead. It's a command-line tool available for Linux, Mac, and Windows.
jhead -n%Y%m%d-%H%M%S *.jpg
will automatically rename all files ending in .jpg
in the current directory to a format like 20181226-111141.jpg
. You can use %f
to also include the original filename (without extension). So, for example:
jhead -n%Y%m%d-%f *.jpg
... which gives the date (and not the time) and the original filename, like 20181226-DSC_0596.jpg
.
Note that there is logic to attempt to not rename files which already are mostly digits, which keeps the command from accidentally acting twice. Use -nf
instead of just -n
to override this. There is also logic to automatically add an incrementing trailing digit if the target filename already exists.
Also, I usually add -autorot
and -ft
to the command line, to match image orientation to the camera's rotation sensor and to make the file time match the exif time.
For simple things where the flexibility, power, and complication of ExifTool aren't necessary, I like to use the tool jhead. It's a command-line tool available for Linux, Mac, and Windows.
jhead -n%Y%m%d-%H%M%S *.jpg
will automatically rename all files ending in .jpg
in the current directory to a format like 20181226-111141.jpg
. You can use %f
to also include the original filename (without extension). So, for example:
jhead -n%Y%m%d-%f *.jpg
... which gives the date (and not the time) and the original filename, like 20181226-DSC_0596.jpg
.
Note that there is logic to attempt to not rename files which already are mostly digits, which keeps the command from accidentally acting twice. Use -nf
instead of just -n
to override this. There is also logic to automatically add an incrementing trailing digit if the target filename already exists.
Also, I usually add -autorot
and -ft
to the command line, to match image orientation to the camera's rotation sensor and to make the file time match the exif time.
answered 6 hours ago
mattdm
118k38348639
118k38348639
1
The problem withjhead
is it requireslibjpeg-turbo-progs
, so it will conflict with packages that requirelibjpeg-progs
.
– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
add a comment |
1
The problem withjhead
is it requireslibjpeg-turbo-progs
, so it will conflict with packages that requirelibjpeg-progs
.
– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
1
1
The problem with
jhead
is it requires libjpeg-turbo-progs
, so it will conflict with packages that require libjpeg-progs
.– xiota
4 hours ago
The problem with
jhead
is it requires libjpeg-turbo-progs
, so it will conflict with packages that require libjpeg-progs
.– xiota
4 hours ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
@xiota That sounds like a distro-specific packaging problem. If I recall correctly, in Fedora we just replaced libjpeg across the board.
– mattdm
1 hour ago
add a comment |
Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.
Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.
Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.
Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Photography Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fphoto.stackexchange.com%2fquestions%2f103767%2fhow-can-i-rename-files-to-match-their-exif-created-date%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown