Sign in to follow this  
Followers 0
Harlequin

Media File Renamer

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Looks intresting, I will have to try it out.. Thank you for sharing.

edit: Tried it.. Awesome! Very nice work.. Keep it up..

Edited by gseller

Share this post


Link to post
Share on other sites

Just gave it a go and I like it. Good work mate.

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0