How can I rename files to match their EXIF “created date”?












3














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?










share|improve this question









New contributor




Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    3














    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?










    share|improve this question









    New contributor




    Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      3












      3








      3


      2





      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?










      share|improve this question









      New contributor




      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      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






      share|improve this question









      New contributor




      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 6 hours ago









      mattdm

      118k38348639




      118k38348639






      New contributor




      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 19 hours ago









      Simon Meade

      162




      162




      New contributor




      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Simon Meade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          6














          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.






          share|improve this answer





























            2














            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.






            share|improve this answer

















            • 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










            • @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













            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.










            draft saved

            draft discarded


















            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









            6














            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.






            share|improve this answer


























              6














              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.






              share|improve this answer
























                6












                6








                6






                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.






                share|improve this answer












                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 7 hours ago









                Blrfl

                4,6761322




                4,6761322

























                    2














                    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.






                    share|improve this answer

















                    • 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










                    • @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


















                    2














                    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.






                    share|improve this answer

















                    • 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










                    • @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
















                    2












                    2








                    2






                    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.






                    share|improve this answer












                    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.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 6 hours ago









                    mattdm

                    118k38348639




                    118k38348639








                    • 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










                    • @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




                      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










                    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












                    Simon Meade is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    How to ignore python UserWarning in pytest?

                    Alexandru Averescu