MOVE FILES FROM SOURCE FOLDER TO ANOTHER FOLDER
I've created a file to which copy all files which is older than certain dates from FromPath to ToPath.but its working.can any one help me out in this code
Sub Copy_Files_Dates()
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileInFromFolder As Object
FromPath = "C:\Temp\New folder" '<< Change
ToPath = "C:\Temp\Test\" '<< Change
FileExt = "*.pptx*"
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If
If Right(ToPath, 1) <> "\" Then
ToPath = ToPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
If FSO.FolderExists(ToPath) = False Then
MsgBox ToPath & " doesn't exist"
Exit Sub
End If
For Each FileInFromFolder In FSO.getfolder(FromPath).Files
Fdate = Int(FileInFromFolder.DateLastModified)
If Fdate >= Date - 30 Then
FileInFromFolder.Copy ToPath
End If
Next FileInFromFolder
MsgBox "You can find the files from " & FromPath & " in " & ToPath
End Sub
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago