Folder Dependency Scanner: Checking What Depends on a Folder Before Moving It

Background

A folder containing Oracle binaries was moved from the C drive to the D drive. Its last-modified date was several years old, and it appeared to be unused. After the move, a number of automated processes stopped working.

The cause was an incorrect assumption: that an old last-modified date means a folder is not in use.

Why modified dates are unreliable

A file's last-modified date records when it was last changed. It does not record whether the file is read or executed. A folder of binaries can remain unchanged for years while being used daily.

Many things can reference a path without modifying anything in it:

  • Scheduled tasks and Windows services
  • Registry entries
  • ODBC data sources
  • Scripts and configuration files with hardcoded paths
  • Environment variables, shortcuts and junctions

None of these update the folder's timestamp, so checking the date alone does not show whether the folder is depended on.

The tool

The Folder Dependency Scanner is a Windows GUI application written in PowerShell. Given a folder path, it checks the locations where dependencies are commonly found and reports the results in a table.

Checks performed

AreaWhat is checked
Scheduled tasksActions, arguments, working directories
ServicesBinary paths
RegistryRun, RunOnce, App Paths, installed software entries
Running processesProcess path and loaded modules
Script referencesHardcoded paths in .ps1, .bat, .cmd, .vbs, .xml, .config, .ini, .sql files in user-specified folders
ODBCSystem and user DSNs (32-bit and 64-bit)
OracleORACLE_HOME registry entries, tnsnames.ora, sqlnet.ora
OtherIIS sites, shortcuts, environment variables, junctions and symlinks
Open handlesOptional, using Sysinternals handle.exe
File detailsFile timestamps and folder owner

Results are colour-coded by risk level, can be sorted, and can be exported to CSV or HTML.

Snapshot and compare

A scan reflects the state of the system at one point in time. The tool can save the results as a snapshot. When a later scan is compared against a saved snapshot, any new findings are marked NEW. This helps identify dependencies added after the initial check.

Read-only operation

The tool does not move, delete, stop or modify anything. All checks are reads or queries. The only files it writes are the reports and snapshots that the user chooses to save.

Development approach

The tool was developed with Claude, an AI assistant from Anthropic. The author defined the requirements, scope and safety constraints, and tested the tool and reported issues. Claude wrote the code. Testing led to several fixes, including a case where a scan returned no results.

Limitations

  • Local machine only. The tool checks the machine it runs on. It does not show whether other servers depend on a folder. For network shares, the file server's open-file and session data is the authoritative source.
  • Literal path matching. A UNC path and a mapped drive letter for the same location are treated as different paths.
  • Script search coverage. Only the folders specified as search roots are searched.
  • No guarantee. A scan with no findings reduces risk but does not prove a folder is unused. Confirming with the application owner is still recommended.
  • Administrator rights. Without elevation, results for services, scheduled tasks and handles may be incomplete.
  • Testing. The tool has been tested against a limited number of folders. Testing in a non-production environment first is recommended.

Download https://github.com/tejjo-gadiraju/Folder-Dependency-Scanner