MS-Access nested DIR - check if a file exists elsewhere whilst looping through a folder

Posted by David Carle on Stack Overflow See other posts from Stack Overflow or by David Carle
Published on 2010-04-29T23:16:29Z Indexed on 2010/04/30 0:37 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

I have used the DIR() command in Microsoft Access 2003 to loop through the files in folder A. This works fine, but I need to check if each file also exists in another location (folder B), and only process the file if it doesn't exist in folder B.

The problem is that checking for the file existing in folder B also uses the DIR() function and this then resets or confuses the original one, with the result that no further files are found in folder A.

Is there a way to check if a file exists without using DIR?

Or, is there a way to have a separate instance of DIR?

I suppose I could build a list of the files in folder A into an array and then process the entries in the array, but this seems rather 'clunky'

Any suggestions for a better solution?

Thanks

© Stack Overflow or respective owner

Related posts about ms-access

Related posts about dir