Real time directory listing
-
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like? Thanks
-
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like? Thanks
Can you please clear out what exactly u want.
Anurag Gandhi. http://www.softgandhi.co.nr
-
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like? Thanks
Monitor the folder using either
ReadDirectoryChangesW()
orFindFirstChangeNotification()
.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like? Thanks
SHChangeNotifyRegister()
function can be used if you want to receive notifications when something in shell namespace is changed... (e.g. file/folder creation, deletion, rename etc..) take a look at http://www.codeproject.com/atl/shellfoldertree.asp, it may help you... http://vbnet.mvps.org/index.html?code/shell/shchangenotify.htm : this is a Visual Basic sample... it might help you... :) -
Can you please clear out what exactly u want.
Anurag Gandhi. http://www.softgandhi.co.nr
I need to know how you will list the files in a directory as the files are added in C++
-
Monitor the folder using either
ReadDirectoryChangesW()
orFindFirstChangeNotification()
.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
What is the best way to list a directory in C++. I've heard of using boost libraries. Any suggestions or comments?
-
SHChangeNotifyRegister()
function can be used if you want to receive notifications when something in shell namespace is changed... (e.g. file/folder creation, deletion, rename etc..) take a look at http://www.codeproject.com/atl/shellfoldertree.asp, it may help you... http://vbnet.mvps.org/index.html?code/shell/shchangenotify.htm : this is a Visual Basic sample... it might help you... :)Any suggestion on listing a directory in C++. I've heard of boost libraries, any comments on it?
-
Any suggestion on listing a directory in C++. I've heard of boost libraries, any comments on it?
Yes, the following article on CP shows how to use Boost libraries for directory listing: http://www.codeproject.com/useritems/find_file.asp and the following one shows how to do the same without using Boost libraries i.e. by using Win32 API functions like
FindFirstFile()
etc. http://www.codeproject.com/cpp/recursedir.asp And, I guess, the second method would be best, because it will eliminate dependencies on Boost libraries as it uses core API functions. :) -
What is the best way to list a directory in C++. I've heard of using boost libraries. Any suggestions or comments?
KirkNarine wrote:
What is the best way...
I guess that all depends on your viewpoint (i.e., what's best for you may not be for others, and vice versa).
KirkNarine wrote:
I've heard of using boost libraries. Any suggestions or comments?
Technically, C++ has no knowledge of folders and other file-system related things. I'm not familar with Boost so any comments would be unjust. In any case, check out
_findfirst()
and_findnext()
.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Yes, the following article on CP shows how to use Boost libraries for directory listing: http://www.codeproject.com/useritems/find_file.asp and the following one shows how to do the same without using Boost libraries i.e. by using Win32 API functions like
FindFirstFile()
etc. http://www.codeproject.com/cpp/recursedir.asp And, I guess, the second method would be best, because it will eliminate dependencies on Boost libraries as it uses core API functions. :)Thanks, you've been a huge help. This is just what I needed
-
I'm trying to generate a directory listing of all the files in a specific directory as files are sent to it. Files are sent to this directory on a regular basis and each file needs to be listed with it's date created attribute. I can't just check by name to see if the file already exist in the list because I'm also checking for duplicates. Can anyone help me at least with how a real-time search coding in C++ will look like? Thanks