Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Comment récupèrer la date de création d'un répertoire

3 réponses
Avatar
TEV
Bonjour,

Je cherche à récupérer la date de création d'un répertoire sous XP. J'ai
essayé avec les api's Filetime et la fonction DateFileTime. Rien ne se passe
hormis des erreurs.

Christian.

3 réponses

Avatar
ng
Salut,

Ceci fonctionne très bien chez moi :

'//Déclaration :

Public Function GetFolderCreationDate(strFolder As String) As Date
If (GetAttr(strFolder) And vbDirectory) = vbDirectory Then
GetFolderCreationDate = FileDateTime(strFolder)
End If
End Function

'//Utilisation (attention pas de de fin !!!!) :

Debug.Print GetFolderCreationDate("c:windows")

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/

TEV a écrit :

Bonjour,

Je cherche à récupérer la date de création d'un répertoire sous XP.
J'ai essayé avec les api's Filetime et la fonction DateFileTime. Rien
ne se passe hormis des erreurs.

Christian.


Avatar
ng
ReSalut,

On pourrait donc faire ceci :

Public Function GetFolderCreationDate(ByVal strFolder As String) As Date
If Right$(strFolder, 1) = "" Then strFolder = Left$(strFolder,
Len(strFolder) - 1)
If (GetAttr(strFolder) And vbDirectory) = vbDirectory Then
GetFolderCreationDate = FileDateTime(strFolder)
End If
End Function


Alors les deux syntaxes fonctionnent :

Debug.Print GetFolderCreationDate("c:windows")
Debug.Print GetFolderCreationDate("c:windows")

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/

ng a écrit :

Salut,

Ceci fonctionne très bien chez moi :

'//Déclaration :

Public Function GetFolderCreationDate(strFolder As String) As Date
If (GetAttr(strFolder) And vbDirectory) = vbDirectory Then
GetFolderCreationDate = FileDateTime(strFolder)
End If
End Function

'//Utilisation (attention pas de de fin !!!!) :

Debug.Print GetFolderCreationDate("c:windows")


Bonjour,

Je cherche à récupérer la date de création d'un répertoire sous XP.
J'ai essayé avec les api's Filetime et la fonction DateFileTime. Rien
ne se passe hormis des erreurs.

Christian.




Avatar
TEV
Merci beaucoup pour la réponse, grâce à vous j'ai vu où se situais mon
erreur.

Christian.
"ng" a écrit dans le message de news:

Salut,

Ceci fonctionne très bien chez moi :

'//Déclaration :

Public Function GetFolderCreationDate(strFolder As String) As Date
If (GetAttr(strFolder) And vbDirectory) = vbDirectory Then
GetFolderCreationDate = FileDateTime(strFolder)
End If
End Function

'//Utilisation (attention pas de de fin !!!!) :

Debug.Print GetFolderCreationDate("c:windows")

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/

TEV a écrit :

> Bonjour,
>
> Je cherche à récupérer la date de création d'un répertoire sous XP.
> J'ai essayé avec les api's Filetime et la fonction DateFileTime. Rien
> ne se passe hormis des erreurs.
>
> Christian.