爱意满满的作品展示区。
mqx

灭霸指令

  •  
  •   mqx ·
    ns2250225 · 5 days ago · 1819 views

    简介:随机删除当前目录一半的文件(移动到回收站,不会真的删除,哈哈哈)

    windows:

    $f=Get-ChildItem . -File -Recurse; $victims=$f | Get-Random -Count ([math]::Floor($f.Count/2)); $shell=New-Object -ComObject Shell.Application; Write-Host "🫰 灭霸响指:共 $($f.Count) 个文件,随机消灭 $($victims.Count) 个"; $i=0; foreach($x in $victims){$i++; Write-Host "[$i/$($victims.Count)] 💨 $($x.FullName)"; $shell.Namespace(10).MoveHere($x.FullName); Start-Sleep -Milliseconds 100}; Write-Host "☠️ 宇宙恢复了平衡。"
    

    linux:

    files=(); while IFS= read -r -d '' f; do files+=("$f"); done < <(find . -type f -print0); total=${#files[@]}; count=$((total/2)); printf '%s\0' "${files[@]}" | shuf -z -n "$count" | { i=0; while IFS= read -r -d '' f; do i=$((i+1)); echo "[$i/$count] 💨 $f"; gio trash "$f"; sleep 0.1; done; }; echo "🫰 宇宙恢复了平衡。"
    

    mac:

    files=(); while IFS= read -r -d '' f; do files+=("$f"); done < <(find . -type f -print0); total=${#files[@]}; count=$((total/2)); trash="$HOME/.Trash/Thanos-$(date +%Y%m%d-%H%M%S)"; mkdir -p "$trash"; printf '%s\0' "${files[@]}" | perl -0MList::Util=shuffle -e '@x=shuffle(<>); print @x[0..$ENV{N}-1]' N="$count" | { i=0; while IFS= read -r -d '' f; do i=$((i+1)); echo "[$i/$count] 💨 $f"; mv "$f" "$trash/"; sleep 0.1; done; }; echo "🫰 宇宙恢复了平衡。文件位于废纸篓中的 $(basename "$trash")"
    
    4 replies    2026-08-23 11:32:25 +08:00
    maolon
        1
    maolon  
       5 days ago
    哈哈哈🤣,拿来测试了一下从网页直接 run 命令的功能能不能拦住
    mqx
        2
    mqx  
    OP
       5 days ago
    @maolon #1 哈哈哈
    TonyLiu1996
        3
    TonyLiu1996  
       16h 54m ago
    光有指令不行,得加上灰飞烟灭的特效才有感觉
    mqx
        4
    mqx  
    OP
       15h 51m ago
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 19:24 · PVG 03:24 · LAX 12:24 · JFK 15:24
    ♥ Do have faith in what you're doing.