in reply to Command To Empty Recycle Bin With Perl?

A Google search for “empty recycle bin from command line” leads to this: http://stackoverflow.com/questions/9238953/how-to-empty-recyclebin-through-command-prompt. The proposed solutions include:

Run these from Perl using backticks or system. Disclaimer: I haven’t tried the approaches suggested. Note the caveats to the first solution.

Hope that helps,

Update: I downloaded and unzipped Frank P. Westlake’s recycle utility. No malware, and it appears to work as advertised. (I’m running Windows 8.1.)

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Command to Empty Recycle Bin with Perl?
by sphinxy09 (Initiate) on Jul 12, 2014 at 12:38 UTC

    Hi Athanasius,

    Do you know what rd and /s actually mean? Regarding %systemdrive% are you to sub a drive letter for systemdrive and type a percent mark on both side of the letter? Also, if your local hard drive is separated into multiple partitions, how do you know which drive letter is correct? My local hard disk is comprised of the C: drive and E: drive, and regardless of a file's original location (C: or E: drive) if I delete it, it moves to the Recycle Bin.

    Thanks!

      Hello sphinxy09,

      rd (a synonym for rmdir) is the MS-DOS command to remove a directory. Without the /s option, the directory must be empty. The /s option:

      Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. (http://www.computerhope.com/rmdirhlp.htm)

      No need to substitute a drive letter for %systemdrive%, that shell variable will already be set for the current command line session. Enter set systemdrive (or just set) from a command line to verify this; for example, I see:

      0:11 >set systemdrive SystemDrive=C: 0:11 >
      My local hard disk is comprised of the C: drive and E: drive, and regardless of a file's original location (C: or E: drive) if I delete it, it moves to the Recycle Bin.

      I can’t test this, but my understanding is that each partition (regardless of its physical location) has its own Recycle Bin. Since Windows Vista, this has the location: Drive:\$Recycle.Bin (see Trash_(computing)#Microsoft_Windows). The contents of the desktop recycle bin are not necessarily the same as the contents of any one of these Recycle Bin directories.

      Hope that helps,

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,