A batch file to delete *.bak files from the Recycle Bin?

B

Bill in Co.

Can someone tell me how to do this? I want to simply run it to delete the
..bak files (using del *.bak) produced every time I compact the OE folders,
instead of having to do this manually each time (by selecting them each time
in the recycle bin, which is a hassle).

I know how to write the batch file, but the Recycle folder is a system
folder, and is apparently locked down so I can't ever get it to work. And
trying to remove the system attribute on the Recycler/Recyled folder doesn't
seem to work either (nor is it probably a good idea).
 
P

Pegasus [MVP]

Bill in Co. said:
Can someone tell me how to do this? I want to simply run it to delete
the .bak files (using del *.bak) produced every time I compact the OE
folders, instead of having to do this manually each time (by selecting
them each time in the recycle bin, which is a hassle).

I know how to write the batch file, but the Recycle folder is a system
folder, and is apparently locked down so I can't ever get it to work.
And trying to remove the system attribute on the Recycler/Recyled folder
doesn't seem to work either (nor is it probably a good idea).

Deleting a file from the Recycled folder by means of a batch file is easy,
provided that you have appropriate privileges. However, there are two issues
that are more serious:
- Interfering with this folder is likely to corrupt the Recycle Bin.
- Deleted files are not stored under their original names but under some
artificial name. The link between the two names appears to be stored in a
filed called INFO2 which is also kept in the this folder. Extracting the
original name from INFO2 does not seem to be straightforward.

In view of the above I suggest you drop the idea. If the OE backup files
cause your disk to get full to capacity then it's time to buy a larger disk.
 
B

Bill in Co.

~BD~ said:
Whist waiting for someone to answer your question, would you please
explain why you don't simply wish to 'empty' your recycle bin like
normal folk do?

Thanks

Sure. Because I do it so often, and I have a few other files and/or
folders in there that I leave in there, in case I want them back, or for the
history. Selecting ONLY the *.bak ones all the time is a nuisance, when a
batch file can do it automatically.
 
B

Bill in Co.

Pegasus said:
Deleting a file from the Recycled folder by means of a batch file is easy,
provided that you have appropriate privileges.

I do - I'm the Administator and sole user of my computer.
However, there are two issues
that are more serious:
- Interfering with this folder is likely to corrupt the Recycle Bin.

Not if I do it right. :)
- Deleted files are not stored under their original names but under some
artificial name.

I can identify the file names, but my access to the folder in a batch file
to do such operations isn't working, that's all. You know, you get the
standard "not resetting the system attribute.." message, or whatever, when
you attempt it in the batch file.
The link between the two names appears to be stored in a
filed called INFO2 which is also kept in the this folder. Extracting the
original name from INFO2 does not seem to be straightforward.

But again, I think I have access to the filenames ok.
In view of the above I suggest you drop the idea. If the OE backup files
cause your disk to get full to capacity then it's time to buy a larger
disk.

No, that's not the issue. The issue is what I explained in my response to
Dave.
 
A

AJR

Regarding "...bak files (using del *.bak) produced every time I compact the
OE folders...." - compacting OE folders does not result in *.bak files.
 
P

Paul Randall

Bill in Co. said:
I do - I'm the Administator and sole user of my computer.


Not if I do it right. :)


I can identify the file names, but my access to the folder in a batch file
to do such operations isn't working, that's all. You know, you get the
standard "not resetting the system attribute.." message, or whatever, when
you attempt it in the batch file.


But again, I think I have access to the filenames ok.


No, that's not the issue. The issue is what I explained in my response to
Dave.

Hi, Dave
If you have some VBScripting skills and can groups.google the
microsoft.public.scripting.vbscript newsgroup, you should be able to find
some sample scripts and snippits that use the shell object to get into
special folders and locate and delete the files of interest.
This thread might contain most of the info you need.
http://groups.google.com/g/78d7fef5/t/33e20952f1cd6185/d/35a48cb73ef9c816

-Paul Randall
 
B

Bill in Co.

AJR said:
Regarding "...bak files (using del *.bak) produced every time I compact
the OE folders...." - compacting OE folders does not result in *.bak
files.

You'd better check again. It most certainly does (assuming you have SP2 or
SP3 installed). They are in your Recycle Bin (assuming you have compacted
them). (They aren't *.bak, they are the foldernames.bak. The *.bak is
for the .bat file)
 
B

Bill in Co.

Paul said:
Hi, Dave
If you have some VBScripting skills and can groups.google the
microsoft.public.scripting.vbscript newsgroup, you should be able to find
some sample scripts and snippits that use the shell object to get into
special folders and locate and delete the files of interest.
This thread might contain most of the info you need.
http://groups.google.com/g/
78d7fef5/t/33e20952f1cd6185/d/35a48cb73ef9c816

-Paul Randall

I'm not sure, but I think you're directing this to me as the OP, and not
Dave.

I know how to delete files in a .bat file, but the problem is being able to
do it with the Recyled folder, which seems to be totally guarded against any
such "encroachments". Are you saying there is no way to do it without
resorting to writing some sort of a VBS script?
 
A

Anthony Buckland

Why go for complicated solutions, when all you have to do
is to open the Recycle Bin, Arrange Icons by Type, click
on the first .bak file, scroll down, Ctrl-Shift click on the last
..bak file, and Delete them?
 
P

Pegasus [MVP]

*** See below.

Bill in Co. said:
I do - I'm the Administator and sole user of my computer.

*** So am I, and I can delete any file in the Recycled folder.
Not if I do it right. :)

*** Please elaborate.
I can identify the file names, but my access to the folder in a batch file
to do such operations isn't working, that's all. You know, you get the
standard "not resetting the system attribute.." message, or whatever, when
you attempt it in the batch file.

*** How can you identify the file?
But again, I think I have access to the filenames ok.


No, that's not the issue. The issue is what I explained in my response to
Dave.

If you can answer the above questions then we can probably find a suitable
method. Note that using a VB Script solution is *not* a magic bullet for
permission issues.
 
B

Bill in Co.

Anthony said:
Why go for complicated solutions, when all you have to do
is to open the Recycle Bin, Arrange Icons by Type, click
on the first .bak file, scroll down, Ctrl-Shift click on the last
.bak file, and Delete them?

Been doing that *repeatedly*. It's like being back in the days of the
horse and buggy. I compact my OE folders regularly since I use it so
often. But since they removed the good ole, automatic compaction *option*
starting with SP2, there isn't much else. (If I could, I would install the
older version of IE6 which had it, but that option isnt even possible with
WinXP SP2/SP3, and there is no way to get that option back (and yes, I know
the "reasons" for MS removing it)
 
J

Jose

Been doing that *repeatedly*.   It's like being back in the days of the
horse and buggy.   I compact my OE folders regularly since I use it so
often.  But since they removed the good ole, automatic compaction *option*
starting with SP2, there isn't much else.   (If I could, I would install the
older version of IE6 which had it, but that option isnt even possible with
WinXP SP2/SP3, and there is no way to get that option back (and yes, I know
the "reasons" for MS removing it)

I don't use OE, but I opened it, compacted, saw the .bak folder in the
RB.

I went to a CMD prompt, typed in:

dir c:\recycler\*.bak /s

and then found all the .bak files, and see the most recent ones from 5
seconds ago were dc something. What do your .bak files look like
using this command? Do the .bak files from the compress start with
dc?

I then typed:

del c:\recycler\dc*.bak /s

The dc*.bak files were deleted, they did not show up in my RB anymore,
OE still works, recycle bin still works.

I repeated multiple times and even rebooted to be sure.

The number after the dc in the name keeps increasing, but you can set
that back to zero in the registry if you think it starts to get too
big, and I don't know what too big is.

I read that you will be prompted to compact after 100 restarts of OE
from the Compact Check Count value but you can change that too. There
is a whole section in the registry for Outlook Express, and I did not
read what they all do.

Why can you just make a batch file that has:

del c:\recycler\dc*.bak /s

and be done with it. That is what works for me.
 
B

Bill in Co.

Pegasus said:
*** See below.



*** So am I, and I can delete any file in the Recycled folder.

Well, I could do it manually. :) But Jose had the solution for a batch
file.
*** Please elaborate.

All I meant was I didn't see how I was going to corrupt it (being generally
pretty careful about what I would do).
*** How can you identify the file?

Evidently I didn't, after reading Jose's post. (So much for my
assumptions, about the actual deleted file names and locations. :)

I was wrong. :)
If you can answer the above questions then we can probably find a suitable
method. Note that using a VB Script solution is *not* a magic bullet for
permission issues.

Got it with Jose's help. But thanks!
 
B

Bill in Co.

Thank you, Jose. This solved it! The /s switch was critical, too.
I was frankly surprised at the displayed names and locations of the deleted
files shown as it executed. So much for my assumptions. :)
I don't use OE, but I opened it, compacted, saw the .bak folder in the
RB.

I went to a CMD prompt, typed in:

dir c:\recycler\*.bak /s

and then found all the .bak files, and see the most recent ones from 5
seconds ago were dc something. What do your .bak files look like
using this command? Do the .bak files from the compress start with
dc?

Yes. And I was surprised at exactly what was listed in there (with the /s
switch, otherwise nada).
I then typed:

del c:\recycler\dc*.bak /s

The dc*.bak files were deleted, they did not show up in my RB anymore,
OE still works, recycle bin still works.

I repeated multiple times and even rebooted to be sure.

The number after the dc in the name keeps increasing, but you can set
that back to zero in the registry if you think it starts to get too
big, and I don't know what too big is.

I read that you will be prompted to compact after 100 restarts of OE
from the Compact Check Count value but you can change that too.

You can, but it gets changed back again, as I recall. What I mean is, it
may not be possible to force compaction every time you close OE. But even
then, it's an all or nothing, all inclusive compaction of ALL the OE folders
(and I have tons), which takes a bit of time, unlike when you manually run
it.
There is a whole section in the registry for Outlook Express, and I
did not ead what they all do.

Why can you just make a batch file that has:

del c:\recycler\dc*.bak /s

and be done with it. That is what works for me.

And for me. Thanks again, Jose.
 
P

Peter Foldes

Bill

You are unbelievable.Pegasus is correct when he said that you can corrupt the
Recycle Bin. Seen it by others who used batch files to remove from the Recycler.
If I were you I would think twice about doing this.Bad move
 
B

Bill in Co.

Please expand on this, Peter. Exactly (and I mean specifically) what did
they do that allegedly "corrupted" the Recycle Bin? Why would just
deleting .bak files in there (just as you can do manually) corrupt it? Do
you have any cite references on this? It sounds like you're just saying
(and assuming): "it's a system folder and can't or shouldn't be touched,
or there will be dire consequences, end of story". ?????
 
B

BillW50

In Bill in Co. typed on Mon, 5 Oct 2009 14:38:02 -0600:
Please expand on this, Peter. Exactly (and I mean specifically)
what did they do that allegedly "corrupted" the Recycle Bin? Why
would just deleting .bak files in there (just as you can do manually)
corrupt it? Do you have any cite references on this? It sounds
like you're just saying (and assuming): "it's a system folder and
can't or shouldn't be touched, or there will be dire consequences,
end of story". ?????

Years ago I too was deleting files in the RecycleBin with a batch file
and it would later become corrupt. So I quit doing this practice right
away. I forget exactly what happens now. But it either stops working
altogether (meaning you can't send anything there) or a second one gets
created after a reboot seems to ring a bell.
 
B

Bill in Co.

BillW50 said:
In Bill in Co. typed on Mon, 5 Oct 2009 14:38:02 -0600:

Years ago I too was deleting files in the RecycleBin with a batch file
and it would later become corrupt. So I quit doing this practice right
away. I forget exactly what happens now.

See, that's the key, and exactly how it happened, and under what operating
system, and under what conditions did it happen, etc, etc. Otherwise, I
don't see that is *necessarily* a problem.

Sure, it's safer to never touch a system folder, or to never use regedit,
for that matter, but I don't think that *necessarily* means it's all off
limits (as long as you exercise due diligence and take some care in what you
are doing, and don't get carried away). In my case, it is one whole *heck*
of a lot more convenient, since I compact OE so often, and want just the
folders that *I* have deleted to be in there (for its history use). And
every time you compact OE it just doubles all the .bak junk added to that
folder.
 
B

BillW50

In Bill in Co. typed on Mon, 5 Oct 2009 15:25:54 -0600:
See, that's the key, and exactly how it happened, and under what
operating system, and under what conditions did it happen, etc, etc.
Otherwise, I don't see that is *necessarily* a problem.

Sure, it's safer to never touch a system folder, or to never use
regedit, for that matter, but I don't think that *necessarily* means
it's all off limits (as long as you exercise due diligence and take
some care in what you are doing, and don't get carried away). In my
case, it is one whole *heck* of a lot more convenient, since I
compact OE so often, and want just the folders that *I* have deleted
to be in there (for its history use). And every time you compact OE
it just doubles all the .bak junk added to that folder.

Well go for it then. The worst that I remember that happens is the
RecycleBin becomes corrupt. So if you are okay with it, that is fine by
me.
 
J

Jose

InBill in Co. typed on Mon, 5 Oct 2009 14:38:02 -0600:


Years ago I too was deleting files in the RecycleBin with a batch file
and it would later become corrupt. So I quit doing this practice right
away. I forget exactly what happens now. But it either stops working
altogether (meaning you can't send anything there) or a second one gets
created after a reboot seems to ring a bell.

Years ago, the RB worked and was maintained differently than today.
Things have changed.

The /s option means:

/s : Lists every occurrence, in the specified directory and all
subdirectories, of the specified file name.

I do not use OE and have never restored anything from my RB in recent
memory, except for today when I explored this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top