How to monitor a folder and trigger a command-line action when a file is created or edited?Run a batch file...
Cursor Replacement for Newbies
Can compressed videos be decoded back to their uncompresed original format?
Why can't we play rap on piano?
iPad being using in wall mount battery swollen
How seriously should I take size and weight limits of hand luggage?
Personal Teleportation: From Rags to Riches
Determining Impedance With An Antenna Analyzer
How to tell a function to use the default argument values?
How do I handle a potential work/personal life conflict as the manager of one of my friends?
GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?
Should I tell management that I intend to leave due to bad software development practices?
Could the museum Saturn V's be refitted for one more flight?
Is it acceptable for a professor to tell male students to not think that they are smarter than female students?
Avoiding the "not like other girls" trope?
Solving a recurrence relation (poker chips)
One verb to replace 'be a member of' a club
What are some good books on Machine Learning and AI like Krugman, Wells and Graddy's "Essentials of Economics"
Expand and Contract
Is "remove commented out code" correct English?
Alternative to sending password over mail?
Why is consensus so controversial in Britain?
What do you call someone who asks many questions?
Why no variance term in Bayesian logistic regression?
What does the expression "A Mann!" means
How to monitor a folder and trigger a command-line action when a file is created or edited?
Run a batch file whenever a file in Dropbox is updatedMonitor folder and move files automaticallyBatch real time wait for a filePowerShell: Limitations of ScriptBlock in Register-ObjectEventIs there a Windows equivalent to OS X's “folder actions”?Sync network directory in a dropbox-like fasion but without cloud uploadWhy does this FFMPEG command when called from Powershell generate white noise?How to use Start Process as an action for FileSystemWatcher in power shellPowershell: Can't post to Slack with otherwise working scriptscript to monitor if a file change within a forderAny utilities for automatically pasting/assembling copied text from the clipboard?Delete locked file/folder from command lineHow to trigger a check for updates in Firefox programatically or from a command line?Change Action Center settings via command line.bat runs from command line but not when scheduledcommand line : Open exe file as if in another folderIncipient instability in Microsoft Task Scheduler?Monitor folder and move files automaticallyRun executable file from task scheduler NOT in background W7How to trigger an event when audio output stops?
I need to set up some sort of a script on my Vista machine, so that whenever a file is added to a particular folder, it automatically triggers a background process that operates on the file. (The background process is just a command-line utility that takes the file name as an argument, along with some other predefined options.)
I'd like to do this using native Windows features, if possible, for performance and maintenance reasons. I've looked into using Task Scheduler, but after perusing the trigger system for a while, I haven't been able to make much sense of it, and I'm not even sure if it's capable of doing what I need.
I'd appreciate any suggestions. Thanks!
windows windows-vista automation scheduled-tasks
add a comment |
I need to set up some sort of a script on my Vista machine, so that whenever a file is added to a particular folder, it automatically triggers a background process that operates on the file. (The background process is just a command-line utility that takes the file name as an argument, along with some other predefined options.)
I'd like to do this using native Windows features, if possible, for performance and maintenance reasons. I've looked into using Task Scheduler, but after perusing the trigger system for a while, I haven't been able to make much sense of it, and I'm not even sure if it's capable of doing what I need.
I'd appreciate any suggestions. Thanks!
windows windows-vista automation scheduled-tasks
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
1
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
2
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11
add a comment |
I need to set up some sort of a script on my Vista machine, so that whenever a file is added to a particular folder, it automatically triggers a background process that operates on the file. (The background process is just a command-line utility that takes the file name as an argument, along with some other predefined options.)
I'd like to do this using native Windows features, if possible, for performance and maintenance reasons. I've looked into using Task Scheduler, but after perusing the trigger system for a while, I haven't been able to make much sense of it, and I'm not even sure if it's capable of doing what I need.
I'd appreciate any suggestions. Thanks!
windows windows-vista automation scheduled-tasks
I need to set up some sort of a script on my Vista machine, so that whenever a file is added to a particular folder, it automatically triggers a background process that operates on the file. (The background process is just a command-line utility that takes the file name as an argument, along with some other predefined options.)
I'd like to do this using native Windows features, if possible, for performance and maintenance reasons. I've looked into using Task Scheduler, but after perusing the trigger system for a while, I haven't been able to make much sense of it, and I'm not even sure if it's capable of doing what I need.
I'd appreciate any suggestions. Thanks!
windows windows-vista automation scheduled-tasks
windows windows-vista automation scheduled-tasks
asked Dec 29 '10 at 8:06
bigmattyhbigmattyh
5972712
5972712
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
1
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
2
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11
add a comment |
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
1
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
2
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
1
1
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
2
2
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11
add a comment |
8 Answers
8
active
oldest
votes
At work we use Powershell to monitor folders.
It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools.
This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool
Example log file
11/23/2014 19:22:04, Created, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:14, Deleted, D:sourceNew Text Document.txt
StartMonitoring.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "D:source"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { $path = $Event.SourceEventArgs.FullPath
$changeType = $Event.SourceEventArgs.ChangeType
$logline = "$(Get-Date), $changeType, $path"
Add-content "D:log.txt" -value $logline
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
Register-ObjectEvent $watcher "Deleted" -Action $action
Register-ObjectEvent $watcher "Renamed" -Action $action
while ($true) {sleep 5}
How to use
- Create a new text file
- Copy & paste the above code
- Change the following settings to your own needs:
- folder to monitor:
$watcher.Path = "D:source"
- file filter to include only certain file types:
$watcher.Filter = "*.*"
- include subdirectories yes/no:
$watcher.IncludeSubdirectories = $true
- folder to monitor:
- Save and rename it to
StartMonitoring.ps1
- Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
Further reading
Documentation for PowerShell's FileSystemWatcher- Documentation for PowerShell's Register-Event
Inspirations for script
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close yourStartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables$created
,$changed
,$deleted
or$renamed
– nixda
Nov 18 '16 at 13:59
add a comment |
You seem to be on the right lines - you could use the task scheduler to run a .bat or .cmd file on a regular basis and that file could start with a line to check for the existence of the required file - in fact, I'd check for the non existence of the file; for example:
@ECHO OFF
REM Example file
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS EXIT 1
REM All this gets done if the file exists...
:
:
EXIT 0
You could also modify this code and have it run in a loop with a, say, 1 minute delay in the loop and then put a reference to the batch file in the Windows startup folder:
@ECHO OFF
REM Example file
:LOOP
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS GOTO SKIP01
REM All this gets done if the file exists...
:
:
:SKIP01
REM Crafty 1 minute delay...
PING 1.1.1.1 -n 10 -w 6000 >NUL
GOTO LOOP
There are other ways of achieving a delay according to the version of Windows running and what additional resource kits have been installed, but the PING command pretty much works under all circumstances. In the PING command above, 10 phantom PINGS are executed with a delay of 6000ms (ie: 6 seconds) between them, you can play with these values to achieve the delay you need between batch file loops.
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the-n 10
vs-n 1
.
– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batchIF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.
– Snekse
Jul 1 '12 at 0:29
|
show 1 more comment
Thanks all, for the suggestions.
I ended up writing a VBScript that was roughly based on Linker3000's idea of polling the folder, and using the Task Scheduler to have it run on startup. I ended up getting the basic syntax from this resource and made the requisite tweaks.
I'd still like to optimize it at some point, having the guts of the script run on an event-driven system, but I've run out of time to work on it, and, well, this is good enough.
Here's the script, in case anyone's interested (with the irrelevant conversion segment redacted for clarity):
' FOLDER TO MONITOR
strFolder = "J:monitored-folder"
' FREQUENCY TO CHECK IT, IN SECONDS
nFrequency = 10
strComputer = "."
strQueryFolder = Replace(strFolder, "", "\\")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM __InstanceCreationEvent WITHIN " & nFrequency & " WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent='Win32_Directory.Name=""" & strQueryFolder & """'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFile = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFile, "=")
strFilePath = arrNewFile(1)
strFilePath = Replace(strFilePath, "\", "")
strFilePath = Replace(strFilePath, Chr(34), "")
strFileName = Replace(strFilePath, strFolder, "")
strTempFilePath = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "TEMP.M4A"
' DO THE OPERATION STUFF
' ...
Loop
(Also, I don't want to leave this question officially unanswered -- and I hate to accept my own answer to the question -- but I did upvote Linker3000's answer as a thanks!)
add a comment |
If the action is just to copy changed files, you can use robocopy /MON
Don't know if robocopy uses FileSystemWatcher or works by polling for changes
add a comment |
Or you could use Watch 4 Folder. Apparently it's Freeware, portable, and compatible with Windows 7. I haven't tried it, but found it through a web search and thought I'd pass it on.
I like the VBS script too, also featured on the site.
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
add a comment |
You might look at DropIt (free). The program is appropriate for processing incoming files in some automated ways. You can move, copy, delete, and pass parameters to other command line programs to convert images, split PDFs, etc.
add a comment |
Also found watchman that seems to be pretty big, and a smaller watchexec I haven't tried.
add a comment |
We use the commercial tool (i.e. not free) Folder Poll from http://www.myassays.com/folder-poll to do just this. It's a Windows application that includes a user-friendly manager application to allow easy configuration. Also, there is an XML configuration option. The actual folder polling runs as a Windows service (so starts automatically on each restart). When a new file is detected in a polled folder an application can be launched automatically (you can specify your own custom command line arguments). It can do other things like copy/move files too. Also, activity can be logged to a log file and there are other advanced operations.
add a comment |
protected by Community♦ Jul 24 '15 at 11:36
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
At work we use Powershell to monitor folders.
It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools.
This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool
Example log file
11/23/2014 19:22:04, Created, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:14, Deleted, D:sourceNew Text Document.txt
StartMonitoring.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "D:source"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { $path = $Event.SourceEventArgs.FullPath
$changeType = $Event.SourceEventArgs.ChangeType
$logline = "$(Get-Date), $changeType, $path"
Add-content "D:log.txt" -value $logline
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
Register-ObjectEvent $watcher "Deleted" -Action $action
Register-ObjectEvent $watcher "Renamed" -Action $action
while ($true) {sleep 5}
How to use
- Create a new text file
- Copy & paste the above code
- Change the following settings to your own needs:
- folder to monitor:
$watcher.Path = "D:source"
- file filter to include only certain file types:
$watcher.Filter = "*.*"
- include subdirectories yes/no:
$watcher.IncludeSubdirectories = $true
- folder to monitor:
- Save and rename it to
StartMonitoring.ps1
- Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
Further reading
Documentation for PowerShell's FileSystemWatcher- Documentation for PowerShell's Register-Event
Inspirations for script
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close yourStartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables$created
,$changed
,$deleted
or$renamed
– nixda
Nov 18 '16 at 13:59
add a comment |
At work we use Powershell to monitor folders.
It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools.
This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool
Example log file
11/23/2014 19:22:04, Created, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:14, Deleted, D:sourceNew Text Document.txt
StartMonitoring.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "D:source"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { $path = $Event.SourceEventArgs.FullPath
$changeType = $Event.SourceEventArgs.ChangeType
$logline = "$(Get-Date), $changeType, $path"
Add-content "D:log.txt" -value $logline
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
Register-ObjectEvent $watcher "Deleted" -Action $action
Register-ObjectEvent $watcher "Renamed" -Action $action
while ($true) {sleep 5}
How to use
- Create a new text file
- Copy & paste the above code
- Change the following settings to your own needs:
- folder to monitor:
$watcher.Path = "D:source"
- file filter to include only certain file types:
$watcher.Filter = "*.*"
- include subdirectories yes/no:
$watcher.IncludeSubdirectories = $true
- folder to monitor:
- Save and rename it to
StartMonitoring.ps1
- Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
Further reading
Documentation for PowerShell's FileSystemWatcher- Documentation for PowerShell's Register-Event
Inspirations for script
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close yourStartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables$created
,$changed
,$deleted
or$renamed
– nixda
Nov 18 '16 at 13:59
add a comment |
At work we use Powershell to monitor folders.
It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools.
This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool
Example log file
11/23/2014 19:22:04, Created, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:14, Deleted, D:sourceNew Text Document.txt
StartMonitoring.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "D:source"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { $path = $Event.SourceEventArgs.FullPath
$changeType = $Event.SourceEventArgs.ChangeType
$logline = "$(Get-Date), $changeType, $path"
Add-content "D:log.txt" -value $logline
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
Register-ObjectEvent $watcher "Deleted" -Action $action
Register-ObjectEvent $watcher "Renamed" -Action $action
while ($true) {sleep 5}
How to use
- Create a new text file
- Copy & paste the above code
- Change the following settings to your own needs:
- folder to monitor:
$watcher.Path = "D:source"
- file filter to include only certain file types:
$watcher.Filter = "*.*"
- include subdirectories yes/no:
$watcher.IncludeSubdirectories = $true
- folder to monitor:
- Save and rename it to
StartMonitoring.ps1
- Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
Further reading
Documentation for PowerShell's FileSystemWatcher- Documentation for PowerShell's Register-Event
Inspirations for script
At work we use Powershell to monitor folders.
It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools.
This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool
Example log file
11/23/2014 19:22:04, Created, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:09, Changed, D:sourceNew Text Document.txt
11/23/2014 19:22:14, Deleted, D:sourceNew Text Document.txt
StartMonitoring.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "D:source"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
$action = { $path = $Event.SourceEventArgs.FullPath
$changeType = $Event.SourceEventArgs.ChangeType
$logline = "$(Get-Date), $changeType, $path"
Add-content "D:log.txt" -value $logline
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED
Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
Register-ObjectEvent $watcher "Deleted" -Action $action
Register-ObjectEvent $watcher "Renamed" -Action $action
while ($true) {sleep 5}
How to use
- Create a new text file
- Copy & paste the above code
- Change the following settings to your own needs:
- folder to monitor:
$watcher.Path = "D:source"
- file filter to include only certain file types:
$watcher.Filter = "*.*"
- include subdirectories yes/no:
$watcher.IncludeSubdirectories = $true
- folder to monitor:
- Save and rename it to
StartMonitoring.ps1
- Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
Further reading
Documentation for PowerShell's FileSystemWatcher- Documentation for PowerShell's Register-Event
Inspirations for script
edited Nov 18 '16 at 14:15
answered Nov 23 '14 at 18:26
nixdanixda
21.1k1179134
21.1k1179134
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close yourStartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables$created
,$changed
,$deleted
or$renamed
– nixda
Nov 18 '16 at 13:59
add a comment |
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close yourStartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables$created
,$changed
,$deleted
or$renamed
– nixda
Nov 18 '16 at 13:59
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
Works nicely but what is the function of the stop script? I get on errors: "Unregister-Event : Cannot bind argument to parameter 'SourceIdentifier' because it is null." pastebin.com/ugLB3a69
– Jan Stanstrup
Nov 18 '16 at 13:45
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close your
StartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables $created
, $changed
, $deleted
or $renamed
– nixda
Nov 18 '16 at 13:59
@JanStanstrup I probably confused more people with the second script. I'll delete it. It's enough to simply close your
StartWatching.ps1
window to stop the monitoring. The second script does only work if you include it in your first script to save the variables $created
, $changed
, $deleted
or $renamed
– nixda
Nov 18 '16 at 13:59
add a comment |
You seem to be on the right lines - you could use the task scheduler to run a .bat or .cmd file on a regular basis and that file could start with a line to check for the existence of the required file - in fact, I'd check for the non existence of the file; for example:
@ECHO OFF
REM Example file
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS EXIT 1
REM All this gets done if the file exists...
:
:
EXIT 0
You could also modify this code and have it run in a loop with a, say, 1 minute delay in the loop and then put a reference to the batch file in the Windows startup folder:
@ECHO OFF
REM Example file
:LOOP
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS GOTO SKIP01
REM All this gets done if the file exists...
:
:
:SKIP01
REM Crafty 1 minute delay...
PING 1.1.1.1 -n 10 -w 6000 >NUL
GOTO LOOP
There are other ways of achieving a delay according to the version of Windows running and what additional resource kits have been installed, but the PING command pretty much works under all circumstances. In the PING command above, 10 phantom PINGS are executed with a delay of 6000ms (ie: 6 seconds) between them, you can play with these values to achieve the delay you need between batch file loops.
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the-n 10
vs-n 1
.
– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batchIF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.
– Snekse
Jul 1 '12 at 0:29
|
show 1 more comment
You seem to be on the right lines - you could use the task scheduler to run a .bat or .cmd file on a regular basis and that file could start with a line to check for the existence of the required file - in fact, I'd check for the non existence of the file; for example:
@ECHO OFF
REM Example file
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS EXIT 1
REM All this gets done if the file exists...
:
:
EXIT 0
You could also modify this code and have it run in a loop with a, say, 1 minute delay in the loop and then put a reference to the batch file in the Windows startup folder:
@ECHO OFF
REM Example file
:LOOP
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS GOTO SKIP01
REM All this gets done if the file exists...
:
:
:SKIP01
REM Crafty 1 minute delay...
PING 1.1.1.1 -n 10 -w 6000 >NUL
GOTO LOOP
There are other ways of achieving a delay according to the version of Windows running and what additional resource kits have been installed, but the PING command pretty much works under all circumstances. In the PING command above, 10 phantom PINGS are executed with a delay of 6000ms (ie: 6 seconds) between them, you can play with these values to achieve the delay you need between batch file loops.
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the-n 10
vs-n 1
.
– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batchIF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.
– Snekse
Jul 1 '12 at 0:29
|
show 1 more comment
You seem to be on the right lines - you could use the task scheduler to run a .bat or .cmd file on a regular basis and that file could start with a line to check for the existence of the required file - in fact, I'd check for the non existence of the file; for example:
@ECHO OFF
REM Example file
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS EXIT 1
REM All this gets done if the file exists...
:
:
EXIT 0
You could also modify this code and have it run in a loop with a, say, 1 minute delay in the loop and then put a reference to the batch file in the Windows startup folder:
@ECHO OFF
REM Example file
:LOOP
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS GOTO SKIP01
REM All this gets done if the file exists...
:
:
:SKIP01
REM Crafty 1 minute delay...
PING 1.1.1.1 -n 10 -w 6000 >NUL
GOTO LOOP
There are other ways of achieving a delay according to the version of Windows running and what additional resource kits have been installed, but the PING command pretty much works under all circumstances. In the PING command above, 10 phantom PINGS are executed with a delay of 6000ms (ie: 6 seconds) between them, you can play with these values to achieve the delay you need between batch file loops.
You seem to be on the right lines - you could use the task scheduler to run a .bat or .cmd file on a regular basis and that file could start with a line to check for the existence of the required file - in fact, I'd check for the non existence of the file; for example:
@ECHO OFF
REM Example file
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS EXIT 1
REM All this gets done if the file exists...
:
:
EXIT 0
You could also modify this code and have it run in a loop with a, say, 1 minute delay in the loop and then put a reference to the batch file in the Windows startup folder:
@ECHO OFF
REM Example file
:LOOP
IF NOT EXIST C:SOMEWHERESUBFOLDERTHISFILE.THS GOTO SKIP01
REM All this gets done if the file exists...
:
:
:SKIP01
REM Crafty 1 minute delay...
PING 1.1.1.1 -n 10 -w 6000 >NUL
GOTO LOOP
There are other ways of achieving a delay according to the version of Windows running and what additional resource kits have been installed, but the PING command pretty much works under all circumstances. In the PING command above, 10 phantom PINGS are executed with a delay of 6000ms (ie: 6 seconds) between them, you can play with these values to achieve the delay you need between batch file loops.
edited Dec 29 '10 at 9:02
answered Dec 29 '10 at 8:49
Linker3000Linker3000
24.7k34265
24.7k34265
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the-n 10
vs-n 1
.
– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batchIF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.
– Snekse
Jul 1 '12 at 0:29
|
show 1 more comment
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the-n 10
vs-n 1
.
– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batchIF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.
– Snekse
Jul 1 '12 at 0:29
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
nice idea.. btw, C:>ping 1.1.1.1 -n 10 -w 6000 for some reason took 1min 10 seconds on my computer. but -n 1 -w 60000 took 1min exactly.
– barlop
Dec 29 '10 at 12:14
@barlop - the ten second discrepancy is due to the
-n 10
vs -n 1
.– user3463
Dec 30 '10 at 2:24
@barlop - the ten second discrepancy is due to the
-n 10
vs -n 1
.– user3463
Dec 30 '10 at 2:24
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
@Randolph Potter Isn't 10 lots of 6 seconds, 60 seconds? and -n 10 that you use, should mean 10 times.
– barlop
Dec 30 '10 at 9:13
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
You're probably right. I take it back and blame my blond hair.
– user3463
Dec 30 '10 at 20:52
I ended up using this loop for a monitoring batch
IF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.– Snekse
Jul 1 '12 at 0:29
I ended up using this loop for a monitoring batch
IF NOT EXIST C:NO_SUCH_FILE_EVER.foo
. Hackish, but it works. Thanks for the idea.– Snekse
Jul 1 '12 at 0:29
|
show 1 more comment
Thanks all, for the suggestions.
I ended up writing a VBScript that was roughly based on Linker3000's idea of polling the folder, and using the Task Scheduler to have it run on startup. I ended up getting the basic syntax from this resource and made the requisite tweaks.
I'd still like to optimize it at some point, having the guts of the script run on an event-driven system, but I've run out of time to work on it, and, well, this is good enough.
Here's the script, in case anyone's interested (with the irrelevant conversion segment redacted for clarity):
' FOLDER TO MONITOR
strFolder = "J:monitored-folder"
' FREQUENCY TO CHECK IT, IN SECONDS
nFrequency = 10
strComputer = "."
strQueryFolder = Replace(strFolder, "", "\\")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM __InstanceCreationEvent WITHIN " & nFrequency & " WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent='Win32_Directory.Name=""" & strQueryFolder & """'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFile = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFile, "=")
strFilePath = arrNewFile(1)
strFilePath = Replace(strFilePath, "\", "")
strFilePath = Replace(strFilePath, Chr(34), "")
strFileName = Replace(strFilePath, strFolder, "")
strTempFilePath = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "TEMP.M4A"
' DO THE OPERATION STUFF
' ...
Loop
(Also, I don't want to leave this question officially unanswered -- and I hate to accept my own answer to the question -- but I did upvote Linker3000's answer as a thanks!)
add a comment |
Thanks all, for the suggestions.
I ended up writing a VBScript that was roughly based on Linker3000's idea of polling the folder, and using the Task Scheduler to have it run on startup. I ended up getting the basic syntax from this resource and made the requisite tweaks.
I'd still like to optimize it at some point, having the guts of the script run on an event-driven system, but I've run out of time to work on it, and, well, this is good enough.
Here's the script, in case anyone's interested (with the irrelevant conversion segment redacted for clarity):
' FOLDER TO MONITOR
strFolder = "J:monitored-folder"
' FREQUENCY TO CHECK IT, IN SECONDS
nFrequency = 10
strComputer = "."
strQueryFolder = Replace(strFolder, "", "\\")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM __InstanceCreationEvent WITHIN " & nFrequency & " WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent='Win32_Directory.Name=""" & strQueryFolder & """'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFile = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFile, "=")
strFilePath = arrNewFile(1)
strFilePath = Replace(strFilePath, "\", "")
strFilePath = Replace(strFilePath, Chr(34), "")
strFileName = Replace(strFilePath, strFolder, "")
strTempFilePath = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "TEMP.M4A"
' DO THE OPERATION STUFF
' ...
Loop
(Also, I don't want to leave this question officially unanswered -- and I hate to accept my own answer to the question -- but I did upvote Linker3000's answer as a thanks!)
add a comment |
Thanks all, for the suggestions.
I ended up writing a VBScript that was roughly based on Linker3000's idea of polling the folder, and using the Task Scheduler to have it run on startup. I ended up getting the basic syntax from this resource and made the requisite tweaks.
I'd still like to optimize it at some point, having the guts of the script run on an event-driven system, but I've run out of time to work on it, and, well, this is good enough.
Here's the script, in case anyone's interested (with the irrelevant conversion segment redacted for clarity):
' FOLDER TO MONITOR
strFolder = "J:monitored-folder"
' FREQUENCY TO CHECK IT, IN SECONDS
nFrequency = 10
strComputer = "."
strQueryFolder = Replace(strFolder, "", "\\")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM __InstanceCreationEvent WITHIN " & nFrequency & " WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent='Win32_Directory.Name=""" & strQueryFolder & """'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFile = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFile, "=")
strFilePath = arrNewFile(1)
strFilePath = Replace(strFilePath, "\", "")
strFilePath = Replace(strFilePath, Chr(34), "")
strFileName = Replace(strFilePath, strFolder, "")
strTempFilePath = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "TEMP.M4A"
' DO THE OPERATION STUFF
' ...
Loop
(Also, I don't want to leave this question officially unanswered -- and I hate to accept my own answer to the question -- but I did upvote Linker3000's answer as a thanks!)
Thanks all, for the suggestions.
I ended up writing a VBScript that was roughly based on Linker3000's idea of polling the folder, and using the Task Scheduler to have it run on startup. I ended up getting the basic syntax from this resource and made the requisite tweaks.
I'd still like to optimize it at some point, having the guts of the script run on an event-driven system, but I've run out of time to work on it, and, well, this is good enough.
Here's the script, in case anyone's interested (with the irrelevant conversion segment redacted for clarity):
' FOLDER TO MONITOR
strFolder = "J:monitored-folder"
' FREQUENCY TO CHECK IT, IN SECONDS
nFrequency = 10
strComputer = "."
strQueryFolder = Replace(strFolder, "", "\\")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM __InstanceCreationEvent WITHIN " & nFrequency & " WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent='Win32_Directory.Name=""" & strQueryFolder & """'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFile = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFile, "=")
strFilePath = arrNewFile(1)
strFilePath = Replace(strFilePath, "\", "")
strFilePath = Replace(strFilePath, Chr(34), "")
strFileName = Replace(strFilePath, strFolder, "")
strTempFilePath = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2) & "TEMP.M4A"
' DO THE OPERATION STUFF
' ...
Loop
(Also, I don't want to leave this question officially unanswered -- and I hate to accept my own answer to the question -- but I did upvote Linker3000's answer as a thanks!)
edited 44 mins ago
mohsensajjadi
1133
1133
answered Jan 7 '11 at 4:01
bigmattyhbigmattyh
5972712
5972712
add a comment |
add a comment |
If the action is just to copy changed files, you can use robocopy /MON
Don't know if robocopy uses FileSystemWatcher or works by polling for changes
add a comment |
If the action is just to copy changed files, you can use robocopy /MON
Don't know if robocopy uses FileSystemWatcher or works by polling for changes
add a comment |
If the action is just to copy changed files, you can use robocopy /MON
Don't know if robocopy uses FileSystemWatcher or works by polling for changes
If the action is just to copy changed files, you can use robocopy /MON
Don't know if robocopy uses FileSystemWatcher or works by polling for changes
answered Nov 30 '16 at 9:15
weberjnweberjn
23026
23026
add a comment |
add a comment |
Or you could use Watch 4 Folder. Apparently it's Freeware, portable, and compatible with Windows 7. I haven't tried it, but found it through a web search and thought I'd pass it on.
I like the VBS script too, also featured on the site.
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
add a comment |
Or you could use Watch 4 Folder. Apparently it's Freeware, portable, and compatible with Windows 7. I haven't tried it, but found it through a web search and thought I'd pass it on.
I like the VBS script too, also featured on the site.
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
add a comment |
Or you could use Watch 4 Folder. Apparently it's Freeware, portable, and compatible with Windows 7. I haven't tried it, but found it through a web search and thought I'd pass it on.
I like the VBS script too, also featured on the site.
Or you could use Watch 4 Folder. Apparently it's Freeware, portable, and compatible with Windows 7. I haven't tried it, but found it through a web search and thought I'd pass it on.
I like the VBS script too, also featured on the site.
edited Nov 27 '12 at 13:05
wonea
1,48211940
1,48211940
answered Mar 12 '11 at 13:01
ChrisChris
111
111
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
add a comment |
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Unfortunately only the paid version is portable
– nixda
Jul 12 '13 at 10:10
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
Was thinking about using this software. Would you trust it to monitor a network share with important files from many users?
– Paul Matthews
Jul 22 '15 at 4:56
add a comment |
You might look at DropIt (free). The program is appropriate for processing incoming files in some automated ways. You can move, copy, delete, and pass parameters to other command line programs to convert images, split PDFs, etc.
add a comment |
You might look at DropIt (free). The program is appropriate for processing incoming files in some automated ways. You can move, copy, delete, and pass parameters to other command line programs to convert images, split PDFs, etc.
add a comment |
You might look at DropIt (free). The program is appropriate for processing incoming files in some automated ways. You can move, copy, delete, and pass parameters to other command line programs to convert images, split PDFs, etc.
You might look at DropIt (free). The program is appropriate for processing incoming files in some automated ways. You can move, copy, delete, and pass parameters to other command line programs to convert images, split PDFs, etc.
answered May 16 '16 at 17:14
SunSun
4,57762542
4,57762542
add a comment |
add a comment |
Also found watchman that seems to be pretty big, and a smaller watchexec I haven't tried.
add a comment |
Also found watchman that seems to be pretty big, and a smaller watchexec I haven't tried.
add a comment |
Also found watchman that seems to be pretty big, and a smaller watchexec I haven't tried.
Also found watchman that seems to be pretty big, and a smaller watchexec I haven't tried.
answered Dec 20 '17 at 2:16
PysisPysis
7401622
7401622
add a comment |
add a comment |
We use the commercial tool (i.e. not free) Folder Poll from http://www.myassays.com/folder-poll to do just this. It's a Windows application that includes a user-friendly manager application to allow easy configuration. Also, there is an XML configuration option. The actual folder polling runs as a Windows service (so starts automatically on each restart). When a new file is detected in a polled folder an application can be launched automatically (you can specify your own custom command line arguments). It can do other things like copy/move files too. Also, activity can be logged to a log file and there are other advanced operations.
add a comment |
We use the commercial tool (i.e. not free) Folder Poll from http://www.myassays.com/folder-poll to do just this. It's a Windows application that includes a user-friendly manager application to allow easy configuration. Also, there is an XML configuration option. The actual folder polling runs as a Windows service (so starts automatically on each restart). When a new file is detected in a polled folder an application can be launched automatically (you can specify your own custom command line arguments). It can do other things like copy/move files too. Also, activity can be logged to a log file and there are other advanced operations.
add a comment |
We use the commercial tool (i.e. not free) Folder Poll from http://www.myassays.com/folder-poll to do just this. It's a Windows application that includes a user-friendly manager application to allow easy configuration. Also, there is an XML configuration option. The actual folder polling runs as a Windows service (so starts automatically on each restart). When a new file is detected in a polled folder an application can be launched automatically (you can specify your own custom command line arguments). It can do other things like copy/move files too. Also, activity can be logged to a log file and there are other advanced operations.
We use the commercial tool (i.e. not free) Folder Poll from http://www.myassays.com/folder-poll to do just this. It's a Windows application that includes a user-friendly manager application to allow easy configuration. Also, there is an XML configuration option. The actual folder polling runs as a Windows service (so starts automatically on each restart). When a new file is detected in a polled folder an application can be launched automatically (you can specify your own custom command line arguments). It can do other things like copy/move files too. Also, activity can be logged to a log file and there are other advanced operations.
answered Apr 14 '16 at 8:34
Mister CookMister Cook
1716
1716
add a comment |
add a comment |
protected by Community♦ Jul 24 '15 at 11:36
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Sounds like you need somethink like Linux's inotify, but for windows. Jnotify might help, but since it's Java might be too heavyweight.
– Keith
Dec 29 '10 at 10:33
1
I was wondering about this too... found the [MSDN page](msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx).
– Keith
Dec 29 '10 at 10:38
2
Link above has ) after aspx: msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx
– Sun
May 16 '16 at 17:11