|Here is a possible solution but you will need to test to see if the concept works, I have tested it and it seems to copy all of yesterdays (18/04/2016) to another folder....|
What you will need to do is
Hold Alt and press F11 to open the VBA IDE
Double click on sheet1 from the top left project explorer
paste the code
then place the cursor over 'CopyYesterdaysFiles' and press F5 to run
Make sure you:
Set RootFolder to the path where you want to copy the files from
Set DestinationFolder to where the files should be copied to
What the code does is loop through all the files in the source folder, extract the modified date from the attributes of the file, check if the date is yesterdays date then copy the file to the destination folder, if the date is in fact yesterday. Not sure if we need to get the date modified or attribute or something else, test and see how this code works for you.
Dim RootFolder As String
Dim DestinationFolder As String
RootFolder = "C:\SourceFolder\"
DestinationFolder = "C:\DestinationFolder\Copy"
If Right(RootFolder, 1) <> "\" Then
RootFolder = RootFolder & "\"
If Right(DestinationFolder, 1) <> "\" Then
DestinationFolder = DestinationFolder & "\"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fol = FSO.GetFolder(RootFolder)
For Each Fil In Fol.Files
If DateDiff("d", Format(Now(), "dd/mm/yyyy"), Left(Fil.datelastmodified, 10)) = -1 Then
FileCopy RootFolder & Fil.Name, DestinationFolder & Fil.Name
message edited by AlwaysWillingToLearn