Link to home
Start Free TrialLog in
Avatar of Stephen Roesner
Stephen RoesnerFlag for United States of America

asked on

Need to copy multiple files by specific name nand modified date

I have 5 file names that I need to copy from one folder to another each day using yesterdays date.
So for example I need to copy over on June 24th, file EFTO.RS5617.DTRRD.D*.* with the date modifed of June 23rd. their might be 1 or 2 or 3 files for that date.
I normally use this code but don't know how to incorporate also looking for the mod date:
   While strFilename >""
      filecopy strPath1 & strFilename, strPath2 & strFilename
   Wend

Any help out there?

Avatar of als315
als315
Flag of Russian Federation image

Try
If  DateValue(FileDateTime(strPath1 & strFilename)) = Date - 1  then
filecopy strPath1 & strFilename, strPath2 & strFilename
End IF

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stephen Roesner

ASKER

This is a great solution and I really appreciate it. I do however have a problem. When I used the code and it worked like a champ, I saw that I need to really look at the create date and not the modified date. Is there a way to use this code and grab the create date instead of the modified date ?


SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much. I haven't had this fast accuarte outstanding help in a while! Again thank you!