Hi
I was hoping someone might be able to assist me/already have a macro which will move files to an archive folder.
Basically I have already have a macro which pulls a list of files from H:\data\Countries... including all files in the subfolders and puts them in a spreadsheet in in column A with the date last modified in column B.
I need to move all files which were last modified before January 2010 to an archive folder which mirrirs the same file path e.g.
H:\data\Countries\ARCHIVE\name of country/name of subfolder/file etc.
I can filter the list of files leaving only the files i need to move, but is there a clean macro which would then move the whole list of files - it will be up around 800+ files so I do not have to do it manually...
I have found this macro online - but can it be tweaked to copy the original folder structure..?
Sub test1() Dim c As Object, x, i As Long, n As Long Set c = CreateObject("Scripting.FileSystemObject") oldpath = "C:\processed\": newpath = "C:\processed\ready\" x = Range([c1], [c1].End(xlDown)) For i = 1 To UBound(x) c.movefile oldpath & x(i, 1), newpath & x(i, 1) n = n + 1 Next: MsgBox n & "files has been successfully moved", vbInformation: End Sub</pre>
Any ideas very welcome!
I was hoping someone might be able to assist me/already have a macro which will move files to an archive folder.
Basically I have already have a macro which pulls a list of files from H:\data\Countries... including all files in the subfolders and puts them in a spreadsheet in in column A with the date last modified in column B.
I need to move all files which were last modified before January 2010 to an archive folder which mirrirs the same file path e.g.
H:\data\Countries\ARCHIVE\name of country/name of subfolder/file etc.
I can filter the list of files leaving only the files i need to move, but is there a clean macro which would then move the whole list of files - it will be up around 800+ files so I do not have to do it manually...
I have found this macro online - but can it be tweaked to copy the original folder structure..?
Sub test1() Dim c As Object, x, i As Long, n As Long Set c = CreateObject("Scripting.FileSystemObject") oldpath = "C:\processed\": newpath = "C:\processed\ready\" x = Range([c1], [c1].End(xlDown)) For i = 1 To UBound(x) c.movefile oldpath & x(i, 1), newpath & x(i, 1) n = n + 1 Next: MsgBox n & "files has been successfully moved", vbInformation: End Sub</pre>
Any ideas very welcome!