Help with getting filenames & then checking for new

D

DonW

Hey all,

I have a number of files on a server (in different directories) that are
periodically updated/added to by other users.

(1) I need to programatically build a list of those filenames and then
(2) to compare the above list to what's on the server and if any are new (on
the server) to get the new filename(s) and file parameters
(such as if it were a music list, then filename, artist, modified date,
etc., etc.).

I'm really hoping I don't have to type all of the current filenames and
parameters into the list first.

Thanks sooooooo much for any help,
Don
 
B

Bob Phillips

Here is some code to show you how to open all files in a folder


Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr

For Each file In Folder.Files
If file.Type Like "Microsoft*Excel*Worksheet*" Then
Workbooks.Open Filename:=file.Path

'do something

Activeworkbook.Close SaveChanges:=False
End If
Next file

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top