# vgmdb-url2list

> **Status:** Active
> **Category:** URL Management
> **Language:** PowerShell
> **Script files:** `urlmakerv2.ps1`, `urllinkmaker.ps1`, `sbudirs.ps1`

## Purpose

Scans directories for Windows `.url` internet shortcut files and exports the extracted URLs to a CSV list. Useful for building a master index of all VGMdb album URLs from a folder structure of `.url` shortcuts, which can then be fed into scraper or comparison scripts.

## Requirements

### Dependencies

PowerShell 5.1 or later (Windows built-in). No additional modules required.

## Input

| Item | Description | Example |
|------|-------------|---------|
| `.url` files | Windows internet shortcut files containing a `URL=` line | `Album info.url` |
| Root directory | Folder to scan — varies by script (see below) | `D:\vgmpptools\URL` |

### `.url` file format

```ini
[InternetShortcut]
URL=https://vgmdb.net/album/12345
```

## Output

| Item | Description |
|------|-------------|
| `output.csv` | CSV file with extracted URL data, written to the scanned directory |

## Scripts

### `urlmakerv2.ps1` — Current-directory scanner (recommended)

Scans the **current working directory** and all subdirectories recursively. Output CSV includes three columns:

| Column | Contents |
|--------|----------|
| `FileName` | Full `.url` filename including extension |
| `Folder` | Parent folder path of the `.url` file |
| `URL` | URL extracted from the `URL=` line |

Output is written to `output.csv` in the current directory.

### `urllinkmaker.ps1` — Current-directory scanner (basic)

Functionally identical to `urlmakerv2.ps1` but outputs only two columns (`FileName`, `URL`) — no `Folder` column. Scans only the top-level directory (no `-Recurse`).

### `sbudirs.ps1` — Hardcoded path scanner

Scans a **hardcoded path** (`D:\vgmpptools\URL`) for `.url` files (top-level only). Outputs a two-column CSV (`FileName`, `URL`) to a hardcoded output path.

> **Warning:** Edit the `$folderPath` and `$outputCsv` variables at the top of `sbudirs.ps1` before running.

## Usage

```powershell
# urlmakerv2.ps1 — run from the folder you want to scan
cd "D:\Music\URL Shortcuts"
.\urlmakerv2.ps1

# urllinkmaker.ps1 — same, current directory
.\urllinkmaker.ps1

# sbudirs.ps1 — edit hardcoded paths first, then run
.\sbudirs.ps1
```

## Examples

```powershell
# Navigate to your URL shortcuts folder and run the recommended script
Set-Location "P:\VGMPP2025"
& ".\urlmakerv2.ps1"
# Exported to P:\VGMPP2025\output.csv

# Inspect the output
Import-Csv ".\output.csv" | Select-Object -First 5
```

Example `output.csv` row:

```
FileName,Folder,URL
"Album info.url","P:\VGMPP2025\Artist - Album","https://vgmdb.net/album/12345"
```

## Notes

- `urlmakerv2.ps1` uses `-Recurse`, so it processes all nested subfolders. `urllinkmaker.ps1` and `sbudirs.ps1` do not recurse.
- If a `.url` file has no `URL=` line it is silently skipped.
- `sbudirs.ps1` has hardcoded paths (`D:\vgmpptools\URL`, `D:\vgmpptools\URL\output.csv`) that must be changed before use.
- The CSV is overwritten each run — there is no append mode.
- Output encoding is UTF-8 (`-Encoding UTF8`).

## Related Scripts

- [vgmdb-compareurl](vgmdb-compareurl.md) — Multi-drive URL extractor; extends the same concept across multiple drive letters
- [vgmdb-urlcleaner](vgmdb-urlcleaner.md) — Clean and normalise `.url` files before extracting
- [url-cleaner-v4](url-cleaner-v4.md) — Python equivalent of the URL cleaning step
