Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find oldest file in folder
#1
I did some searching and sorry to ask this IF in fact it has already been answered.
How can I find the oldest file in a folder?
Example would be great!
Thanks for any suggestions
Kent
#2
Macro Find oldest file in folder
Code:
Copy      Help
str folder="$my qm$"
str fileName ;;can be eg = "*.txt"; finds all if empty

ARRAY(str) a
GetFilesInFolder a folder fileName 64 2
if(!a.len) out "no files"; ret
a.sort
;out a
DateTime t=val(a[0] 1 _i)
t.UtcToLocal
str sPath=a[0]+_i+1
out F"{sPath}    {t.ToStr(4)}"
#3
Gintaras, THANKS! = will try this! I tell all my friends who may have a need for macros about Quick Macros!!!
#4
Gintaras, I KNOW you are busy, but could you tell me 'what' actually determines what file is oldest in the code you shared. This will help me in the long run understand this element of the programming language. THANKS!!!!!!!
#5
GetFilesInFolder with getProp 2 prepends file times to file paths in the array. Then we sort, and the smallest number is in the first element.


Forum Jump:


Users browsing this thread: 1 Guest(s)