--
Jeremy C B Nicoll - my opinions are my own.
Email sent to my from-address will be deleted. Instead, please reply
to newsre...@wingsandbeaks.org.uk replacing "nnn" by "284".
> Is there a way to move a file to the Recycle Bin, under Windows XP, using
> ooRexx or some obscure(?) OS command?
Not in a release version of ooRexx. But in the incubator I have the
start of a new class I mean / meant to add to the distibution called
WinShell. It has methods to move files or directories to the Recycle
Bin, and to recover files from the Recycle Bin.
I don't know a way to do it with an OS command.
If you wanted to try WinShell you can download the needed files from:
http://oorexx.svn.sourceforge.net/viewvc/oorexx/incubator/WinShell.4.0.0/
You would need at the least the *.cls file and the *.dll file from the
bin directory. There is no doc, just some examples I have in an
examples directory.
I haven't worked on it for a year and a half, but I'll be glad to
answer questions.
I'll see if I can take a look at it tomorrow and put together a quick
example for sending something to the Recycle Bin.
--
Mark Miesfeld
I have a "recycle.exe" which does the job. I downloaded it from the web
but cannot find any information on where that might have been. It
doesn't respond to the usual "help" switches.
--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Well, it is currently not usable. I was converting it to use the C++
API introduce in ooRexx 4.0.0, and apparently didn't quite finish.
I'll fix it up today and post again with an example when you can at
least use it to move files to the recycle bin.
--
Mark Miesfeld
> Well, it is currently not usable. I was converting it to use the C++
> API introduce in ooRexx 4.0.0, and apparently didn't quite finish.
>
> I'll fix it up today and post again with an example when you can at
> least use it to move files to the recycle bin.
Thank-you.
Meantime I googled following Swifty's comment, and in amongst all the
suggestions that 'recycle.exe' might be a virus, I found a reference to the
following site:
http://www.maddogsw.com/cmdutils/
Normally I steer clear of websites (like this one) where there's no sign of
recent activity, fearing that something useful might not be maintained. I'd
rather not be dependent on something that can't be relied on... In fact I'm
tempted if I were to use this to put a simple rexx wrapper around it so that
if it failed I could improvise some other almost-but-not-quite-final
deletion strategy in its place.
Certainly I'd rather use the WinShell approach, not least because it would
be integrated with the rest of my ooRexx code, but if making it work turns
out to be too time-consuming, I could use recycle.exe until WinShell sees
the light of day.
I can send you my recycle.exe if you contact me directly. It's been
scanned countless time by Symantec Client Security and I've used it with
no apparent ill-effects.
I looked at it in my editor, but it gives no clues to its origin. It's a
tiny program (5120 bytes) and seems to reference shell32.dll and maybe
mscoree.dll (part of .NET)
Mark Miesfeld wrote:
> On Nov 21, 9:11 pm, Mark Miesfeld <miesf...@gmail.com> wrote:
>> On Nov 21, 1:21 pm, Jeremy Nicoll - news posts
>>
>> <jn.nntp.scrap...@wingsandbeaks.org.uk> wrote:
>>> Is there a way to move a file to the Recycle Bin, under Windows XP, using
>>> ooRexx or some obscure(?) OS command?
>> ... in the incubator I have the
>> start of a new class I mean / meant to add to the distibution called
>> WinShell. It has methods to move files or directories to the Recycle
>> Bin, and to recover files from the Recycle Bin.
Will there be also methods to enumerate the contents and physically deleting files from the recycle bin?
> Well, it is currently not usable. I was converting it to use the C++
> API introduce in ooRexx 4.0.0, and apparently didn't quite finish.
>
> I'll fix it up today and post again with an example when you can at
> least use it to move files to the recycle bin.
Great!
---rony
------------ cut here ---------------
/*
rgf, 2009-11-23
References:
<http://technet.microsoft.com/de-at/library/ee176604%28en-us%29.aspx>, 2009-11-23
<http://technet.microsoft.com/en-us/library/ee176601.aspx>, 2009-11-23
*/
parse arg fn -- get filename
if fn="" then
do
say "no filename given"
exit -1
end
fnFull=qualify(fn) -- fully qualify file name (new in ooRexx 4.0)
fnLoc =filespec("Location", fnFull) -- drive + path (new in ooRexx 4.0)
fnName=filespec("Name", fnFull) -- name
shellApp=.oleObject~new("Shell.Application")
folder=shellApp~nameSpace(fnLoc) -- get folder object
file =folder~parseName(fnName) -- get file object
file~invokeVerbEx("delete") -- one of the actions defined for file objects
------------ cut here ---------------
This solution works, but because of using "invodeVerb[Ex]" the default behaviour prevails, which is
a message box querying whether one really wants to delete the file or not. But then, it still may
proof helpful.
---rony
Okay, I did update this. If you navigate to the incubator at this
URL:
http://oorexx.svn.sourceforge.net/viewvc/oorexx/incubator/WinShell.4.0.0/
You will see a bin directory and an examples directory. From the bin
directory you want to download: WinShell.dll and the WinShell.cls
files. These have to be placed in your path.
In the top level directory there is a file: WinShellSetUp.bat that can
be used to temporarily update the path, but that assumes you maintain
the same directory structure as that in the incubator.
Then there is also a directory called examples. I've just ensured
that they work as expected, and they mostly have good comments
explaining how they work. The deleteToRecycleBin.rex program
specifically shows how to delete files or directories to the recycle
bin.
Since I haven't documented any of this, except what is in the
examples, I'll be glad to answer any questions on how things work.
There is also a testing directory that has more examples, but I can't
guarentee they work at this point. However, it may be helpful to just
read through them for the comments I do have in them.
--
Mark Miesfeld
There is no shell API for enumerating the contents, (other than the
normal file APIs available for any file system object,) just for
getting the number of items and the number of bytes in the recycle
bin. (You can get the items and size for either the global recycle
bin, of the individual recycle bins on individual drives.) WinShell
does have methods for that. There is also an API that empties the
recycle bin, and WinShell also has a method for that.
To individually enumerate the contents, you could use an ooDialog
program and put the files into a list box.
--
Mark Miesfeld
> This solution works, but because of using "invodeVerb[Ex]" the default
> behaviour prevails, which is a message box querying whether one really
> wants to delete the file or not.
Interesting! I've had a little play with that.
In my case I'd want to be able to do it silently (ie no confirmation box)
and possibly also to accept a wildcard filespec.
With the WinShell implementation, you can specify all the different
flags available. So, you can allow confirmation, or make it "silent"
What the WinShell has is a class, the ShellFileOp class. This class
provides an interface to the Windows SHFileOperation() API. You can
do a Google search of:
SHFileOperation MSDN
and read the online documentation for this function. That would give
you more information on how the ShellFileOp class can be used.
--
Mark Miesfeld
> On Nov 23, 7:09�am, rony <Rony.Flatsc...@wu-wien.ac.at> wrote:
> > Will there be also methods to enumerate the contents and physically
> > deleting files from the recycle bin?
>
> There is no shell API for enumerating the contents, (other than the
> normal file APIs available for any file system object,)
Maybe I misunderstand. I thought the whole problem with the recycle bin is
that it doesn't show up in the file system as any kind of normal "file
system object".
If it does, could one for example do a SysFileTree on it?
> To individually enumerate the contents, you could use an ooDialog
> program and put the files into a list box.
How do you get the list of files to put into the list box?
Not sure with Mark's new gimmick (have to download and study all his examples).
Here's an old way:
----------- cut here ------------
shellApp=.oleObject~new("Shell.Application")
-- get the Recycle Bin Folder
recycleBin=shellApp~namespace("10") -- "&ha&") -- "0a"x) -- "&Ha&
say "recycleBin ="pp(recycleBin~self~name)
do i over recycleBin~items
say " i~path="pp(i~path) "i~name="pp(i~name)
end
----------- cut here ------------
---rony