SuperAPI AI Directory

windows-explorer-advanced

Data & analytics

View repository

Updated 10-16 00:04

About this skill

Windows File Explorer Advanced Operations

File Explorer Advanced Operations: Quick Access management, file attribute viewing, disk analysis, recent files, folder statistics. Equivalent to macOS Finder Advanced Operations (macos-finder).

Use Cases

  • User says "show me recently opened files", "how big is this file", "how much disk space is left"
  • User needs to organize Quick Access/Favorites
  • User needs to view folder usage statistics
  • User needs to clean up large files or expired files

Command Reference

File Detailed Information

# 查看文件属性
Get-Item "C:\path\to\file.pdf" | Select-Object Name, Length, CreationTime, LastWriteTime, LastAccessTime, Attributes
Human-readable file size

$file = Get-Item "C:\path\to\file.pdf" $size = switch ($file.Length) { { $_ -gt 1GB } { "{0:N2} GB" -f ($_ / 1GB); break } { $_ -gt 1MB } { "{0:N2} MB" -f ($_ / 1MB); break } { $_ -gt 1KB } { "{0:N2} KB" -f ($_ / 1KB); break } default { "$_ bytes" } } Write-Output "$($file.Name): $size, modified at $($file.LastWriteTime.ToString('yyyy-MM-dd HH:mm'))"

File Hash (verify integrity)

Get-FileHash "C:\path\to\file.zip" -Algorithm SHA256


### 最近使用的文件

```powershell
# 最近打开的文件(Windows Recent 文件夹)
Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent\*.lnk" |
    Sort-Object LastWriteTime -Descending |
    Select-Object -First 20 |
    ForEach-Object {
        $shell = New-Object -ComObject WScript.Shell
        $target = $shell.CreateShortcut($_.FullName).TargetPath
        Write-Output "$($_.LastWriteTime.ToString('MM-dd HH:mm')) — $target"
    }

# 最近修改的文件(指定目录)
Get-ChildItem "$env:USERPROFILE\Documents" -Recurse -File -ErrorAction SilentlyContinue |
    Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) } |
    Sort-Object LastWriteTime -Descending |
    Select-Object -First 20 Name, @{N='Size';E={'{0:N1} KB' -f ($_.Length/1KB)}}, LastWriteTime, DirectoryName

Quick Access Management

# 将文件夹固定到快速访问
$shell = New-Object -ComObject Shell.Application
$shell.Namespace("C:\Users\$env:USERNAME\Projects").Self.InvokeVerb("pintohome")

# 列出快速访问项目
$shell = New-Object -ComObject Shell.Application
$quickAccess = $shell.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}")
$quickAccess.Items() | ForEach-Object { Write-Output "$($_.Name) — $($_.Path)" }

Disk Space Analysis

# 磁盘总体使用情况
Get-PSDrive -PSProvider FileSystem | Select-Object Name,
    @{N='Total(GB)';E={[math]::Round(($_.Used+$_.Free)/1GB,1)}},
    @{N='Used(GB)';E={[math]::Round($_.Used/1GB,1)}},
    @{N='Free(GB)';E={[math]::Round($_.Free/1GB,1)}},
    @{N='Usage%';E={[math]::Round($_.Used/($_.Used+$_.Free)*100,1)}}

# 子目录大小排序(前 10 大目录)
Get-ChildItem "C:\Users\$env:USERNAME" -Directory -ErrorAction SilentlyContinue | ForEach-Object {
    $size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
    [PSCustomObject]@{
        Name = $_.Name
        SizeGB = [math]::Round($size/1GB, 2)
    }
} | Sort-Object SizeGB -Descending | Select-Object -First 10

# 查找大文件(>100MB)
Get-ChildItem "C:\Users\$env:USERNAME" -Recurse -File -ErrorAction SilentlyContinue |
    Where-Object { $_.Length -gt 100MB } |
    Sort-Object Length -Descending |
    Select-Object -First 20 Name, @{N='Size(MB)';E={[math]::Round($_.Length/1MB,1)}}, FullName

Folder Statistics

# 文件数量和类型分布
$path = "C:\Users\$env:USERNAME\Documents"
Get-ChildItem $path -Recurse -File -ErrorAction SilentlyContinue |
    Group-Object Extension |
    Sort-Object Count -Descending |
    Select-Object -First 15 @{N='类型';E={if($_.Name){"*$($_.Name)"}else{'无扩展名'}}}, Count,
        @{N='Total(MB)';E={[math]::Round(($_.Group | Measure-Object Length -Sum).Sum/1MB,1)}}

# 文件总数和总大小
$stats = Get-ChildItem $path -Recurse -File -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum
Write-Output "共 $($stats.Count) 个文件,总大小 $([math]::Round($stats.Sum/1GB,2)) GB"

Recycle Bin Operations

# 查看回收站内容和大小
$shell = New-Object -ComObject Shell.Application
$recycleBin = $shell.Namespace(0xA)
$items = $recycleBin.Items()
Write-Output "回收站中有 $($items.Count) 个项目"
$items | ForEach-Object { Write-Output "$($_.Name) — $($_.Size) bytes" }

# 清空回收站(需确认)
Clear-RecycleBin -Force

Output Specifications

  • File size in human-readable format (KB/MB/GB)
  • Time in natural language ("3 days ago", "just now", "last Friday")
  • Disk space shown intuitively as a bar chart of usage ratio
  • Statistics results formatted as a concise table

Safety Rules

  • HITL confirmation is required before emptying the Recycle Bin
  • Do not delete system files(C:\Windows、C:\Program Files files under
  • Large file cleanup suggestions are listed only; act after user confirmation
  • File attribute viewing is a read-only operation; do not modify files