timestamp in file name

    Putting in order the files on your screw (free space began to catastrophically shrink) was puzzled by organizing all sorts of photos and other video files. The names of the photo files copied from the camera (I have Sony) have a rather uninformative look - DSC00340.JPG. It would be much more convenient, in my opinion, to name the files, using the date and time the picture was taken. It would be possible to sort by date / time, and at a glance determine what era the file belongs to.

    The networks brought several names of programs capable of doing this procedure, but I was interested in another solution published on pcmag.com. It signs step by step, with explanations of how to write a bat-file, consisting of one (well, 2x, if you count echo off) line, and performing the task. True, I had to add 1 character, because the standards for displaying time with us and the Americans are slightly different. I bring the final version, who needs more details - link at the end.

    1. Create a rename.bat file containing the lines: 2. Run it: in the folder with photos 3. Enjoy the result.
    FOR %%V IN (%1) DO FOR /F "tokens=1-5 delims=/:. " %%J IN ("%%~tV") DO IF EXIST %%L%%J%%K_%%M%%N%%~xV (ECHO Cannot rename %%V) ELSE (Rename "%%V" %%L%%J%%K_%%M%%N%%~xV)

    rename.bat *.jpg

    Sopsno, the result pleased me, but not very much. Not enough seconds. But there are no seconds in the information inside the file (or am I mistaken?). The fact is that I have quite a few photos taken in one minute. This batch file does not rename such files, but skips, saying that there is absolutely no way. Well, because such a file already exists. It would be possible to add also the serial number of the photograph taken at that moment ... Maybe someone can tell me what it is necessary to replace "ECHO Cannot rename %% V" so that it renames all the files?

    Yes, the source is here

    Also popular now: