Results 1 to 3 of 3

Thread: File handling question....

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    I'm want to find a file/files in a known directory that were created on today's date...
    Take a look at the GetFileTime API call (www.vbapi.com or www.allapi.net).

    and change their extension so another program doesn't pick them up...
    That'd be the Name command :
    Code:
    Name C:\File.exe as C:\file.bmp

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    New Member
    Join Date
    Nov 2001
    Posts
    3
    Thanks for that, but can you use the 'name as' command with wildcards?
    If not, is it possible to rename "c:\monday*.log" to "c:\monday*.old"

    Cheers

  3. #3

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Um...no It doesn't support wildcards * or ?
    You could perform a loop though...
    Code:
    Private Sub Command1_Click()
        Dim intcounter As Integer
        
        If File1.ListCount < 1 Then Exit Sub
        
        With File1
        
            For intcounter = 0 To (.ListCount - 1)
                .Selected(intcounter) = True
                
                If Left(LCase(.FileName), 6) = "monday" Then
                    Name (.Path & "\" & .FileName) As _
                    (.Path & "\" & Left(File1.FileName, Len(.FileName) - 4) & ".old")
                End If
            Next intcounter
            
        End With
    End Sub
    This one uses a filelistbox and a command button.
    Note that on the form load I set the file1.path to point to a specific folder, and that I don't update the filelistbox when this procedure's finished.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width