Jump to content
Macro Express Forums

Wait For File Exist That I Don't Know Name Of?


Cory

Recommended Posts

I want to monitor a folder for a new file to appear, when it appears then do somethign with it. Problem is the file name will vary. I tried to do a 'wait for file exist' with "*.*" for the name but that didn't work. Got any great ideas how I can do this?

 

I was thinking I could do a repeat with folder ever 5 seconds with a test or maybe I could do a move with a wildcard to a new known name and use a wait for file exist. I just thought I would ask here first in case you would know.

Link to comment
Share on other sites

Hi, Cory,

Tricky, I think. I have no quick answer.

 

I imagine repeat with folder as you say.....

 

What will be your test?

1. just count the number of files and wait till the count is incremented?

2. is the file new, (or just a copy with an old mofified date?), so you can find its name from the most recent file once you know there is an extra one?

 

Good luck; nice to hear how you go?

Randall

Link to comment
Share on other sites

As it turns out in this case I can make the new file a fixed name but I can think of other places where I might need this. Also in this case I can test to see if the folder is empty and choose not to proceed until it is. But I really like yuor counting idea. My idea was a repeat with folder with a time stamp test. Anything with a new name gets processed. This way I don't have to worry about the new file being in the middle as the folder would be processed alphabeticly. I was just hoping someone might already have a slick routine for this.

Link to comment
Share on other sites

as the folder would be processed alphabeticly
If you are using the NTFS file system then this is true. If you are using the FAT32 file system then files are processed in a seemingly random order. In fact they are processed in the order that they appear in the directory on the hard drive.

 

NTFS is only available for Windows 2003, XP, 2000 and NT. Windows 98, Me, and 95 always use FAT32.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...