Looks like I need to update the full scenario here for all.
Our users need to pick up whatever they need from our file server to sync to remote location, but users have limited permissions on file server to move files around. so here is my task:
create a tool that user can use to pickup data and sync to remote location. DFS and 3rd party tools are not options, must be codes made by our own and everything must be running on background.
Here is my way to do it and it is working now. I have made 3 pieces of components:
A** HTA application with VBS sitting on user PC providing user a file browser to pickup data.
B** A shared location that allows that HTA to write data path to a txt file. any path in this text file will be made as softlink into a final location.
C** A final location on file server holds all softlinks.
Here is how basically it works:
User pick a data from file server by using HTA I made, It will write the full data path to the the 000.txt file on the shared location. My endless looping script monitors this shared location, if 000.txt file is created by any user in this shared folder, it will call up another script to read all data paths in this 000.txt and using
mklink to make softlinks based on the paths user provided and outputs softlinks to the final location, then deletes 000.txt file. All softlinks on this final location will be synced by
robocopy during the night on schedule. There are more functions required in my HTA application, there is no need to talk about it.
Since no one here talking about coding, so I deleted my endless loop code, This loop script starts with Windows and running as a service. I can start/stop it anytime I want. It basically just monitors that shared folder, if any user creates 000.txt file in there, it will call up
mklink.bat to make softlins and 000.txt will be deleted by
mklink.bat when softlink are made. The reason that I use an endless loop instead of task scheduler is user need to see results in that final location right after they submit the data path. I thought the minimal interval of task scheduler is one min, (@MikeAWood said it can be 1 second. Thanks!) so I made a this 2 seconds interval endless loop to monitor that shared folder.
My question was the following:
Is this a good idea to running a endless loop on server like forever to monitor a folder?
I monitored the resources usage on server while this script is running. I dont see any significant consumings...so I guess it will be harmless right?
If task scheduler can handle 1 second interval, I guess my question is solved. Thanks to you all.
Or if you have better way to do this or any opinion on the way I do it.