UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Copy Files Based On Last Modified Date And Time, Access 2013    
 
   
g0049978
post Sep 17 2019, 04:08 PM
Post#1



Posts: 26
Joined: 13-September 19



I want my code to look at the prior 2 days and copy any files from the SharePoint directory that was last modified in the hour of 5am.

Here is my code that copies all the files from the prior 2 days and it works but I only need the file(s) that were modified in the 5am hour:

Public Sub copyshare()


Dim fileSystem, folder, file
Dim path

path = "\\sharepoint.abc.com@SSL\DavWWWRoot\sites\FIS\staffing\Shared Documents\Staffing Open Cases by Bucket\"

Set fileSystem = CreateObject("Scripting.FileSystemObject")
Set folder = fileSystem.GetFolder(path)

For Each file In folder.Files


If DateDiff("d", file.DateLastModified, Now) < 2 Then

fileSystem.CopyFile "\\sharepoint.abc.com@SSL\DavWWWRoot\sites\FIS\staffing\Shared Documents\Staffing Open Cases by Bucket\" & file.Name, "c:\users\Public\Sources\"

MsgBox (file.Name & " last modified at " & file.DateLastModified)
End If
Next

End Sub
Go to the top of the page
 

Posts in this topic



Custom Search


RSSSearch   Top   Lo-Fi    12th November 2019 - 09:40 PM