in reply to Command To Empty Recycle Bin With Perl?

I use Perl and WinZip's command line interface to automatically move ("-m" operator adds to ZIP and deletes from original location) folders / files to ZIP files. In PERL v5.6.1 the "move" would permanently delete the folders / files but in PERL v5.16.1 the "move" only moves the files to the Recycle Bin

This doesn't sound right. From what you're saying, I assume you're doing something like this: system('winzip -m ...');

If that is the case, then the version of Perl has absolutely zero effect on how WinZip operates and the change in behaviour is due to something else changing on your system (I'm guessing you have switched to a different PC?). Probably the easiest fix will be to go into the Recycle Bin settings and disable the Recycle Bin.

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

    Hi Simon,

    I'm actually using  system "wzzip -m ..." Nothing has changed on my PC besides the version of Perl, which was an upgrade from 5.6.1 to 5.16.1; I'm using the same PC and same version of WinZip, and no other applications on the PC have changed. Having the result of this upgrade change a permanent delete to a move to Recycle Bin was definitely unexpected. I don't want to disable the Recycle Bin because it needs to be available for other purposes, so any other suggestions?

    Thanks!

      Hi, Sphinxy09

      I stand by what I said earlier - Perl does not interact with the recycle bin in this fashion (indeed, I am sceptical that any application could legitimately hijack the delete function in Windows like this). The method you are using to run WinZip is basically the same as you opening a command prompt and typing wzzip -m .... If you try this now, WinZip should exhibit exactly the same behaviour as when Perl calls it.

      As for a fix, you can go with either Athanasius' suggestion, or with bulk88's code (though I would suggest changing line 13 to my  $return = SHEmptyRecycleBin(0, "", 1); once you are certain it is doing what you want (the 1 tells Windows to run the command without prompting for confirmation)