Trying to make auto sorting macro

Creating macros. Working with QM.

Trying to make auto sorting macro

Postby ryuukl on Sat Sep 16, 2017 4:44 pm

Hello,

I was trying to make a macro to move my photos to folder according to photo file names(date), all my photos and folder formats as below:

Folder Name
January
February
March
April
etc...

Photo File Name
IMG_20170723_153937.jpg
(20170723 = 23 July 2017)
(153937= 3.39pm 37 Seconds)

I just wanted to auto sort it according to month, but have no luck..

hope anyone can teach me how to start.

Thanks.
ryuukl
 
Posts: 1
Joined: Sat Sep 16, 2017 4:35 pm

Re: Trying to make auto sorting macro

Postby Gintaras on Sun Sep 17, 2017 7:45 pm

Macro Macro1018     ?
str folder="Q:\test\photos"
ARRAY(str) a
GetFilesInFolder a folder "IMG_????????_??????.jpg"
if(a.len=0) out "no files"; ret
a.sort(8) ;;out a

int i
for i 0 a.len
,str& path=a[i]
,str monthN.get(path folder.len+9 2) ;;out monthN
,str month.gett("January February March April May June July August September October November December" val(monthN)-1) ;;out month
,str monthFolder=F"{folder}\{month}"
,mkdir monthFolder
,ren path monthFolder

Gintaras
Site Admin
 
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron