Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any simple way to put file names into the text file?
Message
 
 
À
24/01/2008 19:59:16
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Windows
Catégorie:
Informatique en général
Divers
Thread ID:
01285227
Message ID:
01298975
Vues:
18
>>Kurt,
>>
>>Yours an Einar solutions will not work for they will sort (or not at all) for creation date and Naomi asked for modified date, something like this will be required for it:
>>
>>DIR * /O-D /TW > FileList.txt
>>
>>Anyways, if it is so easy to do with .NET (something I really believe) why don't the .NET guys provide a solution instead....
>
>You successfully baited me.
>
>Try this (not tested and not in 2005. There are better ways to do it in 2005)
>
>            Dim files() As String
>            Dim fileList As New System.Text.StringBuilder
>            Dim myDate As DateTime = Date.Parse("1/22/2008")
>            Dim fileInfo As IO.FileInfo
>
>            files = IO.Directory.GetFiles("C:\", "*.*")
>
>            For i As Integer = 0 To files.Length - 1
>                fileInfo = New IO.FileInfo(files(1))
>                If fileInfo.LastWriteTime > myDate Then
>                    fileList.Append(files(i))
>                    fileList.Append(Environment.NewLine)
>                End If
>            Next
>
>            Dim writer As New IO.StreamWriter("C:\filelist.txt")
>            writer.Write(fileList.ToString)
>            writer.Close()
>
Do we have simple translation from VB to C#? Also does it have to be in a new project or how can I execute one program?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform