the FolderRemoveEventHandler isn't global, it can just be used to notify when a folder is removed from the top level of a specific folders collection. I need an event to fire when any folder is removed/deleted - does such a thing exist?
I'm afraid not, but there is nothing stopping you from recursively registering for all the folders events at application start.
Related
Recently I am trying to build a file system watcher on my computer with Windows 7. I am using FileSystemWatcher of Powershell, it works quite good! I can monitor file/folder creating, deleting, renaming and file changing, including all files and folders in subfolders. But when I want to monitor the situation that user opens a folder, for example by double clicking, I cannot find any event listeners in Powershell for that, but it is quite important for my file system watcher.
Does Powershell have this kind of event listener for getting the event of opening a folder? Or there is another better way to do it.
ReadDirectoryChanges windows api does not give file/folder move events(It works with rename events though). Instead It gives deleted and added events. How do we differentiate this from a real delete and add event.
edit: Is there a unique property for a folder in windows that does not change when the folder moves within a drive?.
I would like to know how to capture the file move event on Windows.
An event of Moving a folder/file to another location.
I tried JNotify. It supports renamed, modified, deleted,created events, but not moved event.
I remember that on Windows (XP/Vista/7, may be NTFS) provide a service or something like that, which support the moved event.
Does anyone know the name of the service/tool/library name or suggest a solution/workaround?
Thanks.
you might want to try filesystemwatcher?
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.71%29.aspx
you could use:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
i've done a tool using this - maybee it helps you with a workaround
https://plus.google.com/u/0/b/109583811292415142803/109583811292415142803/
Last few days i have been working on building an application to hide folders(thanks to the paid versions of such softwares). After a heavy googling I zeroed into some shell script that would first create a folder and then rename the folder to "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}". It would then hide this folder by using the command attrib -s -h Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}. The funda behind this is to make it a system folder and hide it. But if you would uncheck the Hide sytem folders in Folder option the control panel becomes visible. I would like to make this folder completely invisible as how the other folder protecting softwares do.
Can somebody throw some more light on this?
Thanks a ton...
Most folder hiding software works by implementing either an extension for Windows Explorer or a file system filter driver.
The first method means that certain items will not be visible when browsing folders in Windows via the UI, but will still be visible to other software and via the command prompt. For example, the Recycle Bin and Temporary Internet Files folders work this way.
The file system filter driver method proxies calls between Windows and the underlying file system and only allows certain requests through. This is similar to how virus scanners prevent access to infected files.
The general idea is that you hook the file system API's and filter out the file system entries you want to hide.
But JelloMonkey is right - this is rootkit behavior and you will get flagged as malicious by rootkit detectors for this kind of behavior. That's likely to get your entire directory quarantined or deleted.
In my apps (VB6 and C# 2008) on Windows 2003 twice now I have seen similar behavior regarding deletion of folders containing files. My code will build some temporary folders and generates files in that folder for subsequent processing. Upon processing completion, my code will try to delete the generated temp folder. The delete operation completes without error.
However, upon further inspection, you can see that the folder still exists in windows explorer. Attempting to browse this folder results in a permission denied error. Later on the app will process another round of files and try to create the temp folder again. Unfortunately, the previous Pending Delete has not finished so trying to create the folder again results in permission denied error. The folder is not truly deleted until i close my app. As soon as the app is closed the folder gets deleted. Why are my folder delete operations not committed until the app is closed?
I wonder - is it possible you have accidentally retained a lock on that directory? that would explain why the directory cannot be removed until your app has departed.
There are some tools - try SysInternals - which will list file/directory locks. Try your app and then see if it retains a lock. I think you can then forcefully remove that lock - see then if the directory immediately disappears.