Auto Open Latest Files
Automatically open the newest file from one or more configured folders, directly from VS Code.
Features
- Open the newest file by target path.
- Support multiple targets with quick pick selection.
- Optional file extension filtering — single or comma-separated (e.g.
.log, .txt).
- Optional exclude list for file names, extensions, or folder names.
- Choose sort criterion: modification time or creation time.
- Optional recursive folder scanning.
- Auto-open the newest file on every refresh cycle.
- Auto-close previously auto-opened files when a newer match is found.
- Sidebar views:
Latest Files: quickly open, reveal, and copy paths.
Configuration: manage target rows from a webview UI.
Requirements
Extension Settings
Targets (vscode-auto-open-latest-files.targets)
An array of folder targets to scan for the newest matching file.
| Property |
Type |
Required |
Description |
id |
string |
Yes |
Unique identifier for this target. |
path |
string |
Yes |
Absolute path to the folder to scan. |
fileType |
string |
No |
Comma-separated extension filter(s) including dot, e.g. .log, .txt. Omit to match all files. |
exclude |
string[] |
No |
File names, extensions, or folder names to exclude (e.g. .DS_Store, node_modules). |
sortBy |
string |
No |
modificationTime (default) or creationTime. |
searchSubdirectories |
boolean |
No |
Recursively scan nested subdirectories. Default: false. |
Example:
{
"vscode-auto-open-latest-files.targets": [
{
"id": "app-logs",
"path": "/absolute/path/to/logs",
"fileType": ".log",
"exclude": [".DS_Store"],
"sortBy": "modificationTime",
"searchSubdirectories": true
}
]
}
Other Settings
| Setting |
Type |
Default |
Description |
vscode-auto-open-latest-files.refreshInterval |
number |
60 |
How often (in seconds) the Latest Files sidebar rescans. Minimum: 5. |
vscode-auto-open-latest-files.autoOpen |
boolean |
false |
Automatically open the newest file for each target on every refresh cycle. |
vscode-auto-open-latest-files.autoClose |
boolean |
false |
Automatically close previously auto-opened files when a newer match is found. Requires autoOpen. |
Commands
| Command |
Title |
vscode-auto-open-latest-files.openLatestFile |
Open Latest File |
vscode-auto-open-latest-files.refreshTargets |
Refresh |
Context menu commands available in the Latest Files tree:
| Command |
Title |
vscode-auto-open-latest-files.openLatestFileInEditor |
Open |
vscode-auto-open-latest-files.revealLatestFileInExplorer |
Reveal in File Explorer |
vscode-auto-open-latest-files.copyLatestFilePath |
Copy Path |
vscode-auto-open-latest-files.copyLatestFileRelativePath |
Copy Relative Path |
How It Works
- Configure one or more targets in settings (or the Configuration sidebar view).
- Run
Open Latest File from the Command Palette.
- If multiple targets exist, pick one from the quick pick list.
- The extension scans files, selects the newest match, and opens it in the editor.
- Optionally enable
autoOpen to have the newest file opened automatically on each refresh.
Known Limitations
- Target paths must be absolute paths.
- When no files match a target, a warning notification is shown.
License
MIT.
| |