sebbu

clean-recycle-bin

Aug 15th, 2026
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. dirs=`find '/cygdrive/'*'/$RECYCLE.BIN/' -maxdepth 1 -type d -name 'S-*'`
  3. for dir in ${dirs}
  4. do
  5.         cd "$dir"
  6.         files=`'ls' '$I'* 2>/dev/null`
  7.         for file in ${files}
  8.         do
  9.                 sfile=${file:2}
  10.                 res=`'ls' '$R'$sfile 2>/dev/null|wc -l`
  11.                 if [[ "$res" -eq 0 ]]
  12.                 then
  13.                         'rm' "${file}"
  14.                 fi
  15.         done
  16.         cd
  17. done
  18. # verify results (before & after) with `find /cygdrive/*/*recycle*/`
  19.  
Advertisement
Add Comment
Please, Sign In to add comment