in reply to Re: Command to Empty Recycle Bin with Perl?
in thread Command To Empty Recycle Bin With Perl?

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!

Replies are listed 'Best First'.
Re^3: Command to Empty Recycle Bin with Perl?
by Athanasius (Archbishop) on Jul 12, 2014 at 14:29 UTC

    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,