UNC File Watcher
This project is a Go-based local web console for watching files in UNC paths and copying or moving them to local directories.
After build, the program is a single exe. The target machine does not need Go installed.
Features
The program supports two rule types at the same time:
-
Archive rule Watches
.tar.gzCopies or moves files to azipdirectory Skips when thezipdirectory already has a file with the same name Skips when theunzipdirectory already has an extracted folder with the same name -
Generic file rule Watches other file types by extension list Only needs
UNC source path + local target pathDoes not useunzipSupports two dedupe modes
Generic File Dedupe
The generic file rule supports these dedupe modes:
-
Same name and same sizeThis is the default mode If the target directory already has a file with the same name and the same size, the file is skipped If the target directory already has a file with the same name but a different size, it is treated as a conflict and skipped without overwrite -
Same name and same hashWhen the target directory already has a file with the same name, the program computes SHA-256 for source and target If the hashes match, the file is skipped If the hashes do not match, it is treated as a conflict and skipped without overwrite
Stable File Detection
To avoid processing a file while another service is still writing it in the UNC path, the program checks both conditions:
size + modified timestay unchanged across multiple scans- the last modified time is older than
stable_for
Suggested starting values:
scan interval: 15s
stable_for: 1m
stable_scans: 3
Build
go build -o unc_tar_watcher.exe .
Run
.\unc_tar_watcher.exe
Default listen address:
http://127.0.0.1:18080
To change the port:
.\unc_tar_watcher.exe -listen 127.0.0.1:19090
Web UI Settings
Archive Rule
- Enable archive rule
- Archive UNC source path
- Zip path
- Unzip path
Generic File Rule
- Enable generic file rule
- Generic file UNC source path
- Local target path
- Extension list, for example
.csv,.txt,.pdf - Dedupe mode
Shared Settings
- Scan interval
- Stable duration
- Stable scan count
- Transfer mode:
copyormove - Recursive scan
Local Settings File
The web UI saves settings automatically next to the executable:
unc_tar_watcher_settings.json
When you open the page again, the last saved settings are loaded automatically.
Runtime Notes
- In
copymode, source files remain in the UNC path - In
movemode, the program copies first and then removes the source file - The generic file rule never overwrites an existing target file when a conflict is detected
- The archive rule only handles
.tar.gz