Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Can I trigger a scheduled task when the contents of a folder change?


13 Aug 2012   #1

Windows 7 Home Premium 64bit
 
 
Can I trigger a scheduled task when the contents of a folder change?

Hello everyone,

I want to use the windows task scheduler to run a task when something is copied to a folder on my server. When this happens several programs run and extract files, rename them and move them automatically.

Right now I have the window task scheduler running a task every 5 minutes on this folder so when something get's copied into it the files will be processed, however this is a really bad way of doing this. I saw under the task scheduler trigger I could begin the task on an event and that I could create a filter based on something.

The problem is I don't know if there is anything that can be used when a folder changes. I have attached a picture showing the trigger and filter screen so you can see what I am talking about. Is there something on the right (encircled with red) that I could use?

I know that there are a lot of ways of doing this (monitoring a folder) and a lot of other programs that will "just do it for you", but I would like to come up with a solution using windows task scheduler if possible.

Thank you in advance for your help.
-S




Attached Thumbnails
Can I trigger a scheduled task when the contents of a folder change?-task-scheduler.jpg  
My System SpecsSystem Spec
.

16 Aug 2012   #2

Windows 7 Home Premium 64bit
 
 

Well I guess this must not be done very often as still no replies. If a mod thinks this should be in a different forum could you let me know? If someone knows of a forum that would be better I would love to hear about it.

Thanks again for any help you can provide.

-S
My System SpecsSystem Spec
18 Dec 2012   #3

windows 7 Enterprise
 
 
Same problem but...

Hi nzdreamer55,

I am a software engineer. I was looking for an easy solution to do exactly what you want, but it looks like very few people need this. So I am going to work on it tonight. I will let you know what I find out.

Serge
My System SpecsSystem Spec
.


4 Weeks Ago   #4

Windows 8.1 64
 
 

Dude, did you manage to get the correct answer from anybody? I need exactly the same thing. Thanks
My System SpecsSystem Spec
4 Weeks Ago   #5

windows 7 Enterprise
 
 

Sorry but I do not recall what happened regarding this project. I either got too busy with more important issues or found that you can't do this with Window Scheduler.
The following article confirms the second possibility is true:
Build a 'Folder Watcher' Service in C# | .NET Framework content from Dev Pro
My System SpecsSystem Spec
4 Weeks Ago   #6

Windows 7 32 bit
 
 

I hope the server is mostly idle. Any time I tried anything that automatically detected folder changes it bogged the entire system by hogging the HD. It relentlessly checks every file in the folder tree to see if the modification,access times etc.. are the same as last time. If you have thousands of files in that folder tree you can see why the system would bog.

For this type of stuff to work smoothly I suspect the file system needs to be implemented as a true relational database. Then changes are logged as they happen. No big performance hit.

I don't know any Windows file system that fits that description though.

Edit: Long story short, you are probably better off polling every so many minutes.
My System SpecsSystem Spec
4 Weeks Ago   #7

Windows 7 Pro 32
 
 

Here's an VBS example that uses WMI to subscribe to file changes in a folder: New, changed, deleted
I've tried it briefly without problems.

WMI and File System Monitoring - CodeProject
My System SpecsSystem Spec
4 Weeks Ago   #8

Windows 7 Pro 32
 
 

And if you modify the above VBS example to write a specific event in the event log instead of alerting messages, you can then set a trigger for this new event in a scheduled task. Example:

VB Script to write an event with specific eventID and eventSource into eventlog
My System SpecsSystem Spec
4 Weeks Ago   #9

Windows 7 32 bit
 
 

WMI may work a bit better. But I know for a fact the WinAPI for file change notification is a dog. You have more leeway with a server to be sure. Running the WinAPI call on the workstation is a disaster.
My System SpecsSystem Spec
Reply

 Can I trigger a scheduled task when the contents of a folder change?




Thread Tools



Similar help and support threads for2: Can I trigger a scheduled task when the contents of a folder change?
Thread Forum
Task Scheduler recognizes only first trigger Performance & Maintenance
Scheduled Task history indicates task completed successfully but.... Performance & Maintenance
Change password in Scheduled task General Discussion
Can't install > can't change contents of folder. Installation & Setup
Unable to change folder contents on remote folder in same HomeGroup Network & Sharing
Help with using idle trigger in Win Task Scheduler Performance & Maintenance
schedule a task to trigger on firefox's launch Software

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:12 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33