Comparing dates (1 Viewer)

crdfox

New member
Local time
, 02:30
Joined
Jan 6, 2012
Messages
6
I have a loop that goes through file names in a folder.
The file names are all like this 0418tue.pbn
The first 2 numbers are the Month and the next 2 numbers are the day.

In the loop I use the MID methord to extract these 2 items.


What I would like is something like this
If Month AND Day = today then (I do Not know how to write this part)
copy that file to another folder.
End if



Any help appreciater.
Regards crdfox
 

C3P420

New member
Local time
Today, 12:30
Joined
Apr 18, 2023
Messages
5
I have a loop that goes through file names in a folder.
The file names are all like this 0418tue.pbn
The first 2 numbers are the Month and the next 2 numbers are the day.

In the loop I use the MID methord to extract these 2 items.


What I would like is something like this
If Month AND Day = today then (I do Not know how to write this part)
copy that file to another folder.
End if



Any help appreciater.
Regards crdfox

Since you're using a loop, I'm going to assume you're holding the file path in a variable called strFilePath and that the file actually exists (since your looping through the files in a folder)

Code:
If Left$(Dir(strFileName), 4) = Format(Now(), "mmdd") Then
    FileSystem.FileCopy strFileName, "C:\DestinationDirectory\" & Dir(strFileName)
End If
 

Users who are viewing this thread

Top Bottom