Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deleting unfound external files

0 views
Skip to first unread message

John

unread,
Jun 8, 2006, 9:51:13 AM6/8/06
to
Hi

How can I do this programmatically;

1. Read the first file in a folder.

2. Search for its path+name in a field in a table.

3. If not found, delete the file in the folder.

4. Repeat from step1 until all files in the folder checked.

Thanks

Regards


Douglas J Steele

unread,
Jun 8, 2006, 12:01:28 PM6/8/06
to
Something like the following untested air-code:

Dim strFolder As String
Dim strFile As String

strFolder = "C:\Some Folder\Some Subfolder\"
strFile = Dir$(strFolder & "*.*")
Do While Len(strFile) > 0
If IsNull(DLookup("[SomeField]", "[SomeTable]", _
"[PathAndFile] = '" & strFolder & strFile & "'") Then
Kill strFolder & strFile
End If
strFile = Dir()
Loop

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"John" <Jo...@nospam.infovis.co.uk> wrote in message
news:%23wKEaKw...@TK2MSFTNGP03.phx.gbl...

0 new messages