Jump to content

Media File Renamer


Harlequin
 Share

Recommended Posts

What it does:

Renames media files (jpg, jpeg, bmp, mpg, mpeg, png, gif, tif, tiff, avi, flc) based on their date, so in the directories, they will show up in order, and not duplicate names, etc.

It Looks first at the standard Digital EXIF data, and uses that for the file name. If that is absent, then it looks to the file creation date. If that is absent, it will give the file a date & time of all "0"'s (0000-00-00_###, etc.)

Files are all appended with a 3 digit number, so files with the same date (& time) would be named, for example:

YYYY-MM-DD_HH_MM_SS_###.ext

2008-12-07_14-22-55_001.jpg, 2008-12-07_14-22-55_002.jpg,...2008-12-07_14-22-55_999.jpg

OR:

YYYY-MM-DD_###.ext

2008-12-07_001.jpg, 2008-12-07_002.jpg,...2008-12-07_999.jpg

It DOES NOT check across directories, so in 2 directories, files can end up with the same name, but within the SAME directory they can NOT.

ExifTool.au3

But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security. - U.S. Declaration of Independence

Link to comment
Share on other sites

@Harlequin

Nice work :o

btw, can you make 'back' option because after done that Ive renamed files in a folder I didnt want to; I renamed all files :)

Idea for back option : write all back names and new names in a file

Cheers, FireFox.

Link to comment
Share on other sites

  • 3 months later...

Hi,

Very nice!

Pls try my simple code conversion from my vb script "ExifDate.vbs".

Drag Drop JPG file(s) and rename to Timestamp of Exif Date / File Modified Date.

^_^

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_outfile=ExifDate.exe

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; ExifDate.au3

; Author TMax

#include <file.au3>

local $szDrive, $szDir, $szFName, $szExt

Local $FileSave, $FilePath, $FileDate, $Files, $fContents

Local $t, $Ret

Local $lExif, $lColon

$Files = $CmdLine

For $i = 1 To $Files[0]

$FilePath = _PathSplit($Files[$i] , $szDrive, $szDir, $szFName, $szExt)

If StringUpper($FilePath[4]) <> ".JPG" then ExitLoop

$fContents = FileRead ($Files[$i], FileGetSize ($Files[$i]))

$lExif = StringInStr ($fContents, "Exif")

if $lExif > 0 then

$lColon = StringInStr ($fContents, ":")

If $lColon > 0 and StringMid($fContents, $lColon + 3 , 1) = ":" Then

$FileDate = StringMid($fContents, $lColon - 4, 19)

$FileDate = StringReplace($FileDate, ":", "-")

EndIf

Else

$t=FileGetTime($Files[$i],1)

$FileDate= $t[0] &"-" & $t[1] & "-" & $t[2] & " " & $t[3] & "-" & $t[4] & "-" & $t[5]

EndIf

$FileSave=$FilePath[1] & $FilePath[2] & $FileDate & $FilePath[4]

If $FileSave=$FilePath[3] Then ExitLoop

If FileExists ($FileSave) Then

$Ret=MsgBox(256+4+64,"Confirm File Rename","This folder already contains a file named '" & $FileDate &"'." & _

@CRLF & @CRLF & "Would you like to rename the existing file with " & @CRLF & $FileDate & "~c" )

if $Ret=6 then FileMove($files[$i],$FilePath[1] & $FilePath[2] & $FileDate & "~c" & $FilePath[4]) ;diff name with "~c"

Else

FileMove($Files[$i],$FileSave)

EndIf

Next

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...