Date de dernière modif d'un fichier

cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003 - 15 mai 2003 à 11:15
tawac Messages postés 37 Date d'inscription vendredi 17 juin 2005 Statut Membre Dernière intervention 28 octobre 2005 - 6 juil. 2005 à 14:56
Bonjour à tous, j'ai trouvé sur ce forum que la date d'un fichier, c'est
datefic = FileDateTime("MonFichier")

Mais ça doit être la date de création, moi j'ai besoin de la date de dernière modification.

Est ce que quelqu'un sait comment faire ?

6 réponses

cs_moustachu Messages postés 1079 Date d'inscription jeudi 14 novembre 2002 Statut Membre Dernière intervention 1 janvier 2012
15 mai 2003 à 11:26
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
15 mai 2003 à 11:27
une example avec c;\a.txt

Private Sub Command1_Click()
ShowFileAccessInfo "c:\test.txt"
End Sub

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
15 mai 2003 à 11:51
Moi j'ai fait comme ça

Private Sub File1_dblClick()
Dim datefic As String
Dim taillefic As String
Dim monfichier As String
Dim monchemin As String

MsgBox (File1.ListCount)

monfichier = File1.List(ListIndex - 1)
monchemin = Label3.Caption & "" & monfichier

datefic = FileDateTime(monchemin)

taillefic = FileLen(monchemin)

Label9.Caption = "date : " & datefic & " taille : " & taillefic

End Sub

mais il me donne la date et la taille du repertoire, pas de l'entrée de la listbox File1 selectionnée.
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
15 mai 2003 à 14:06
tu dois le faire comme ca :

Private Sub File1_dblClick()
Dim datefic As String
Dim taillefic As String
Dim monfichier As String
Dim monchemin As String

MsgBox ShowFileAccessInfo(File1)

'monfichier = File1.List(ListIndex - 1)
'monchemin = Label3.Caption & "" & monfichier

'datefic = FileDateTime(monchemin)

'taillefic = FileLen(monchemin)

'Label9.Caption = "date : " & datefic & " taille : " & taillefic

End Sub

Function ShowFileAccessInfo(filespec)

Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
's = UCase(filespec) & vbCrLf
's = s & "Created: " & f.DateCreated & vbCrLf
's = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
ShowFileAccessInfo = "Last Modified: " & f.DateLastModified
'MsgBox s, 0, "File Access Info"
End Function
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
tawac Messages postés 37 Date d'inscription vendredi 17 juin 2005 Statut Membre Dernière intervention 28 octobre 2005
6 juil. 2005 à 14:40
Il existe DateLastModified , DateCreated et DateLastAccessed

Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(specfichier)
s = s & "Dernière modification le : " & f.DateLastModified
0
tawac Messages postés 37 Date d'inscription vendredi 17 juin 2005 Statut Membre Dernière intervention 28 octobre 2005
6 juil. 2005 à 14:56
Pour répondre à ta question:
FileDateTime renvoie la date de dernière modification, je viens de le tester.
Si le fichier n'a jamais été modifié, la date de création est alors renvoyée.

à +
tawac
0
Rejoignez-nous