Solved

monitor folders for files added, removed, renamed in a thead

Posted on 2007-11-16
9
976 Views
Last Modified: 2008-12-03
Hi all, I want to be able to do a system wide hook on all files and folders copied, renamed,  removed, created or deleted....
I need to do it in a thread and get the changes added to a listbox or something so I can do what I want with them with stopping it capturing the file/folder changes still.
I have tried a couple of components, but none of them seem to capture all the files.
For example, I copy a folder from one drive to another drive with loads of small files inside it, It seems to get a few of them, but looses all the rest.

Anyone want to post me some code up so I can get started on the program I want to do.

Cheers


0
Comment
Question by:satmanuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
9 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 20298618
you want this system wide?
0
 
LVL 1

Author Comment

by:satmanuk
ID: 20298678
well across all the drives.
Or even be able to just monitor a load or folders at the same time.
0
 
LVL 16

Expert Comment

by:CodedK
ID: 20298920
Hi satmanuk

You can try this component :
http://www.torry.net/authorsmore.php?id=4053

This is a Windows API based component for monitoring any changes in specified local or remote folder. Unlike other Directory Monitors, this one doesn't lose events, even remote.

Monitored Events:

    * File/Folder Creation, Modify, Change, Deletion, Rename.
    * Security changes.
    * A single notification for every event.
    * Subdirectory notification.
    * The event receives the Path + File Name affected and selected Action.
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:MerijnB
ID: 20298930
did you to use something like this: http://atorg.net.ru/delphi/atfilenotification.htm ?
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 20298948
both probably use FindFirstChangeNotification  internally, did you use something like that yourself already?
0
 
LVL 16

Accepted Solution

by:
CodedK earned 250 total points
ID: 20299078
I think one of the best is this :
http://www.delphi.com.ar/vcl/ShellNotify.zip
    * File type association has changes;
    * File attributes changes;
    * A non-folder item creation / deletion / rename;
    * A non-folder item deletion;
    * Drive insertion / removed;   <----
    * Drive insertion and the Shell should create a new window for the drive;   <----
    * Storage media has been inserted / removed;   <----
    * Folder Creation / Deletion / Renamed;
    * Folder Sharings / Unsharing;   <----
    * Network Disconnection;   <----
    * The contents of an existing folder changes;
    * An image in the system image list changes;   <----
    * An existing nonfolder item changes, but the item still exists and has not been renamed.    <----
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~

Here you can find many components for this :
http://www.torry.net/pages.php?id=252
0
 
LVL 1

Author Comment

by:satmanuk
ID: 20309169
i want to be able tomonitor multiple drives and folders, i would have to have a folder monitor creater for each drive or folder with most of the components i have seen so far.
I need to be able to select a load of drives or folder and monitor them all the time for changes and aditions.
I have looked a the dir mon component, but i found it dropped to many files in my few test with it.
i looked at ShellNotify and this seemed to do what i needed on a XP box, but onc i added a few folders to it to monitor, i found i missed files when i copied them from drive to drive

I wondered if it was because i was using Delphi 2007, but tried in in my old delphi 6 and get the same results..

Strange.
0
 
LVL 1

Author Comment

by:satmanuk
ID: 20309212
not to worry, i seem to have got the shellnotify to collect the data..... Delphi 6 worked.

0
 
LVL 16

Expert Comment

by:CodedK
ID: 20309248
Why C Satmanuk?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question