Sign in to follow this  
Followers 0
carabusu

how to find the last created subfolder

5 posts in this topic

I have a folder with a lot of subfolders and i need to find out which is the last created subfolders.

Tnx

Share this post


Link to post
Share on other sites



i have a fast look in the function list and seem like there's no Foldergettime(), but as my personal view, you can use _Filelisttoarray() to list all subfolder, save them then use it to compare later

the new will not be in the list


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

i have a fast look in the function list and seem like there's no Foldergettime(), but as my personal view, you can use _Filelisttoarray() to list all subfolder, save them then use it to compare later

the new will not be in the list

Tnx a lot, its working

Share this post


Link to post
Share on other sites

Here's a bit of code I use for that:

Func _NewestDir($sPath, $Flag=0)
    If Not FileExists($sPath) Then Return SetError(1, 0, -1)
    If Not StringInStr(FileGetAttrib($sPath), "D") Then Return SetError(2, 0, -1)
    Local $dList = _FileListToArray($sPath, "*", 2)
    if not IsArray($dList) then
        msgbox (0, "Error", "Could not get folderlist from " & $sPath)
        Return
    endif
    If Ubound($dList) > 1 Then
        Local $NewstDir = $dList[1], $GetNewstDirTime = 0, $GetDirTime, $iArr
        For $iArr = 1 To $dList[0]
            $GetDirTime = FileGetTime($sPath & "\" & $dList[$iArr], $Flag, 1)
            If $GetDirTime > $GetNewstDirTime Then $NewstDir = $dList[$iArr]
            $GetNewstDirTime = FileGetTime($sPath & "\" & $NewstDir, $Flag, 1)
        Next
        Return $NewstDir
    Else
        Return SetError(1, 0, -2)
    EndIf
EndFunc

Use $Flag to indicate which timestamp

0 = Modified (default)

1 = Created

2 = Accessed

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