Jump to content

Renaming files based on acquisition date


Recommended Posts

Hi all guys,

in my folder I have different files (mostly .jpgs) of pics i did during my last holidays.

These have been done with different sources so they have different names (IMG_xxxx.jpg, DSCN_yyyy.jpg, ...).

So I can order them by "acquisition date" rather than name or other dates.

I would like to rename all of them like IMG_ORDERED_xxx.jpg

Can you help me writing a routine that can read all files in folder and rename them one by one based on acquisition date?

Thanks a lot for support,

Marco

Link to comment
Share on other sites

  • Moderators

@marko001 Yes we can certainly help (although help and writing it for you are two very different things). Start by looking at _FileListToArray to get all of your .jpgs into a single array. Once you have that complete, post what you have and we can work on the next steps.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I personally use a product FileMenu Tools (an Explorer Shell product), if you can find version 7.0.5 its fully functional, the latest version has limitations without purchase.  Within the tool it has an Advanced Renamer program that allows you to rename multiple files, including using meta data from photos/images and MP3 etc... See screenshot below.  Another product which is freeware is Advanced Renamer, which I've also used in the past, however I prefer the FileMenu Tools version, because it offers other tools that I use daily.

 

FileMenuTools.jpg

Link to comment
Share on other sites

7 hours ago, luis713 said:

Yes, it is easy to do that but most of the users in the forum try teach instead of writing the script

Hi Luis,

you right, I write A.it since years and I don’t need “all done”.

i just need an hint on how to order files by acquisition date rather than name or others. 

Thanks again,

M. 

Link to comment
Share on other sites

7 hours ago, JLogan3o13 said:

@marko001 Yes we can certainly help (although help and writing it for you are two very different things). Start by looking at _FileListToArray to get all of your .jpgs into a single array. Once you have that complete, post what you have and we can work on the next steps.

Hi Logan and thanks,

as I wrote to Luis I obviously don’t need the full code. 

I just need to know how to order array/files based on acquisition date and nor name. 

Thanhs again,

M. 

Link to comment
Share on other sites

Here is the result of array

#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

Global $aFileList
$sMessage = "Select Folder"
$sFileSelectFolder = FileSelectFolder($sMessage, "")

;~ $sFileSelectFolder = "Z:\2018\08 - USA\_Presentazione"

If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
Else
    $aFileList = _FileListToArrayRec($sFileSelectFolder, "*", $FLTAR_NOHIDDEN)
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.")
        Exit
    EndIf
EndIf
_ArrayColInsert($aFileList, 1)
_ArrayColInsert($aFileList, 2)
_ArrayColInsert($aFileList, 3)

For $i = 1 To UBound($aFileList) - 1
    $aFileList[$i][1] = FileGetTime($sFileSelectFolder & "\" & $aFileList[$i][0], 0, 1)
    $aFileList[$i][2] = FileGetTime($sFileSelectFolder & "\" & $aFileList[$i][0], 1, 1)
    $aFileList[$i][3] = FileGetTime($sFileSelectFolder & "\" & $aFileList[$i][0], 2, 1)
Next

_ArraySort($aFileList, 0, 0, 0, 1)
_ArrayDisplay($aFileList, "$aFileList")

As you can see it's sorted on creation date (not acquisition date, I can't get it)

So here is what I expect but what I get:

SS_1003.bmp is a screenshot from explorer, ordered by acquisition date (that's what I want to rename)

SS_1004.bmp is the generated array

As you can see they are not sorted correctly (so I can't rename them correctly)

Thanks for support

 

SS_1003.bmp

SS_1004.bmp

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...