Re: Copy all files created within one day, etc. by Its
Its
Sun Apr 08 19:18:59 CDT 2007
Dim obj_FSO, obj_Folder, obj_File
Set obj_FSO = CreateObject("Scripting.Filesystemobject")
Set obj_Folder = obj_FSO.GetFolder("C:\scripts\")
For each obj_File in obj_Folder.Files
If DateDiff("d", now(), obj_File.DateCreated) => -1 Then
msgbox obj_File.DateCreated & vbcrlf & _
DateDiff("d", now(), obj_File.DateCreated)
' Code to copy file
End If
Next
Bryan
"qjlee" <qjlee@discussions.microsoft.com> wrote in message
news:FE6996B4-35B1-43C8-B338-89AE0498D212@microsoft.com...
>I have two questions:
>
> 1). I need to create a script to copy all files within a folder. All
> files
> are created on the same day. This script only copies the files if it is
> created within one day. If such files are not available, then, try again
> two hours later.
>
> 2). I need to copy a text file from a folder. This text file is generated
> once a week and has a naming convention as test*.txt. However, can I
> create
> a script to copy only the file generated within one day.
>
> Thanks,