Listening to a folder and File Manipulations

Hey all!

I'm writing a proggie that will "listen" to a folder, when this folder is filled with some files (doesn't matter how many, even one) it will take the filename and will perform an operation on the filename (Using it as a parameter in a command line) and then it should delete the file.
It should perform that action until folder is empty again and then return to the "listening" mode.

Can anyone point me to the right direction? I don't know how to do it...
(I'm using VC++ 2005 on WinXP in case you're wondering, it's a Win32 Console App...)

Thanks in advanced!

John.
You want the Win32 file change notification functions:
http://msdn.microsoft.com/en-us/library/aa364417(VS.85).aspx

At the bottom of that link there is another link to a complete example.


Another option is the ReadDirectoryChangesW() function.

Hope this helps.
This helps a lot, thanks!

One quick question regarding the post, I have to provide a LPCTSTR variable as the first argument, can you please explain what's the syntax for LPCTSTR?

Thanks in advance.

John.
An LPCTSTR is a wchar_t*.

P.S. Weee define chain!
It could be a char* too... depending on how you are compiling.

Unless you have knowingly enabled Unicode, chances are it is a char*.
Topic archived. No new replies allowed.