A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Delete many empty directories



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old August 29th 17, 07:11 PM posted to alt.windows7.general
masonc
external usenet poster
 
Posts: 152
Default Delete many empty directories

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)
Ads
  #2  
Old August 29th 17, 08:25 PM posted to alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Delete many empty directories

masonc wrote:
Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


Is there a permissions problem ?

You could list all the directories and
make a script with one "rd" per line if you want.

Or I'm sure someone gifted at writing such scripts
could write you one :-)

If your attempts to remove are causing a dialog box to
pop up for some reason, then that would be a valid reason
for a wild card attempt to not work.

*******

If you do:

rd /?

it offers /s for recursive, and /q for quiet mode.
Maybe the quiet mode will provide sufficient suppression
for the wild-card call to work ?

*******

There are articles for this, too.

https://stackoverflow.com/questions/...command-prompt

You will notice there is a clever robocopy command,
which removes all empty folders below folder1. Now
this is neat and tidy... but needs to be tested
on an inert folder tree first. You want to carefully
test this doesn't have unexpected side effects.

ROBOCOPY folder1 folder1 /S /MOVE

A folder might not be considered empty, if it has
a desktop.ini file in it. There might be a reason
for mis-behavior in some cases. In File Explorer,
there is a Tools:View option to make "system" files
visible, and then the desktop.ini files can be seen.
It's both a feature and a nuisance, that option
(as it can cause a couple desktop.ini files to appear
on your actual desktop).

Paul
  #3  
Old August 29th 17, 09:45 PM posted to alt.windows7.general
Char Jackson
external usenet poster
 
Posts: 10,449
Default Delete many empty directories

On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


I've been using RED (Remove Empty Directories) for quite a few years and
haven't had any problems with it. It's freeware.

http://www.jonasjohn.de/red.htm


--

Char Jackson
  #4  
Old August 29th 17, 10:03 PM posted to alt.windows7.general
Micky
external usenet poster
 
Posts: 1,528
Default Delete many empty directories

In alt.windows7.general, on Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


If anything can do this easily, it's tcc/le , which is free. Nope. RD
doesn't have much more than DOS.

Then there is XXCopy, which I know for sure has commands regarding empty
directories, but I'd want to do some testing before letting it run wild.
Make a mistake and you delete who knows what else. (In the real world,
people have test environments, but most home users don't have one!). On
second thought, since Kan is so specific, I think moderate testing would
be enough. He also has a subcommand that will make a command run and
display messages but not actually do anything. I've never used it.
There's a mailing list.

XXCopy is in flux right now, because the owner died, until the son takes
over, but you can get a copy of the free version from me.

Here is what seems like the most relevant page from his help file:



Number : 3
Date : 2001-05-10
Author : Kan Yabumoto
Subject : How to remove empty directories
Size(KB) : 1
--------------------------------------------------------------------------------


Here's a trick to remove empty directories using XXCOPY.

XXCOPY \yourdir\ /RSY /S /X*

Explanation:

/RSY remove source directory (in this case \yourdir\)

== He is rarely confusing but here I think he is. IIUC yourdir would be
something like C:\ . He calls it the source directory because
everything related to xxcopy relates to copying source to target, and
the directory listed first is the source, but in this case there is no
target. (It doesn't mean source code or anything like that.)

/S including subdirectories
/X* exclude all files (* == same as *.* in Win32)

== better get /X* exactly right, because that's what keeps it from
deleting what you don't want deleted.

This technique takes advantage of the exclusion feature which
does not delete any existing file in the directory. Since
a subdirectory with a file (or subdirectory) won't be deleted,
the only subdirectories that are deleted are empty ones.
To make this command work better, you may want to add
the following switches

/H include hidden directories
/R handle read-only directories
/PD0 suppress prompt on directory
/Q2 quiet (no display on skipped files)

--------------------------------------

Incidentally, the following XXCOPY command line will do the opposite
(delete all files and leave directory skeleton behind)

XXCOPY \yourdir\ /RSY /S /ED /PD0

here,

/ED preserve an empty directory

Again, you may add /H /R /Q2 to make it more bullet-proof.

Kan Yabumoto


--------------------------------------------------------------------------------
This message if part of XXCOPY's message Archive.
The archive contains all the messages posted at Yahoo!Groups: XXCOPY.


Apparently when I wasn't looking Kan changed to using google search and
the site: subcommand to search his website. So you can find more in
google search with

empty site:http://www.xxcopy.com

For example here is the second hit, which discusses why this works.
http://www.xxcopy.com/xarc/msg/msg05313.htm

But basically it's a subset of his copy command, which has loads of
options including the option to not copy empty subdirectories in the
source and to delete them, so that the sourc matches the target. So why
do you need a target if your goal is to delete things in the source?
Well, you don't. And that is what is above.

He has logging too.


Kan had a great mind and I can't keep in my head even half of what this
program could do (And I can't imagine what the paid version could do
that the free version doesn't). So I would just work at getting it to
do specific things I wanted to do, put them in a bat file, and save
them. That's what I would do with this if I were you.
  #5  
Old August 30th 17, 01:24 AM posted to alt.windows7.general
Zaidy036[_6_]
external usenet poster
 
Posts: 79
Default Delete many empty directories

Paul wrote:
masonc wrote:
Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


Is there a permissions problem ?

You could list all the directories and
make a script with one "rd" per line if you want.

Or I'm sure someone gifted at writing such scripts
could write you one :-)

If your attempts to remove are causing a dialog box to
pop up for some reason, then that would be a valid reason
for a wild card attempt to not work.

*******

If you do:

rd /?

it offers /s for recursive, and /q for quiet mode.
Maybe the quiet mode will provide sufficient suppression
for the wild-card call to work ?

*******

There are articles for this, too.

https://stackoverflow.com/questions/...command-prompt

You will notice there is a clever robocopy command,
which removes all empty folders below folder1. Now
this is neat and tidy... but needs to be tested
on an inert folder tree first. You want to carefully
test this doesn't have unexpected side effects.

ROBOCOPY folder1 folder1 /S /MOVE

A folder might not be considered empty, if it has
a desktop.ini file in it. There might be a reason
for mis-behavior in some cases. In File Explorer,
there is a Tools:View option to make "system" files
visible, and then the desktop.ini files can be seen.
It's both a feature and a nuisance, that option
(as it can cause a couple desktop.ini files to appear
on your actual desktop).

Paul


Look at https://blogs.msdn.microsoft.com/old...17-00/?p=22703

Also batch cmd For Files

--
Zaidy036
  #6  
Old August 30th 17, 01:07 PM posted to alt.windows7.general
masonc
external usenet poster
 
Posts: 152
Default Delete many empty directories

On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


Thanks for the suggestions.
  #7  
Old August 30th 17, 07:47 PM posted to alt.windows7.general
J. P. Gilliver (John)[_4_]
external usenet poster
 
Posts: 2,679
Default Delete many empty directories

In message , Char Jackson
writes:
On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


I've been using RED (Remove Empty Directories) for quite a few years and
haven't had any problems with it. It's freeware.

http://www.jonasjohn.de/red.htm


Not sure if it's quite what the OP wants - "batch" suggests he wants
automation - but I'd certainly second the endorsement of RED. Nicely
written, IMO (I mean the way it works; I haven't seen the source code!).
--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

"Address the chair!" "There isn't a chair, there's only a rock!" "Well, call
it a chair!" "Why not call it a rock?" (First series, fit the sixth.)
  #8  
Old August 31st 17, 08:13 AM posted to alt.windows7.general
masonc
external usenet poster
 
Posts: 152
Default Delete many empty directories

On Tue, 29 Aug 2017 15:45:57 -0500, Char Jackson
wrote:

On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


I've been using RED (Remove Empty Directories) for quite a few years and
haven't had any problems with it. It's freeware.

http://www.jonasjohn.de/red.htm


Thanks for the RED suggestion. Seems to work wonders. Removed a
thousand empties. ---
However, I quickly hit "Exit" when it scanned 1193 empty among 30873
files in my *System plus Programs C:* Scared me.
Thanks again.
  #9  
Old August 31st 17, 11:29 AM posted to alt.windows7.general
Stan Brown
external usenet poster
 
Posts: 2,904
Default Delete many empty directories

On Tue, 29 Aug 2017 11:11:35 -0700, masonc wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


What does "doesn't work" mean? What error message do you get? Are
_any_ directories deleted, and if so what were their positions in the
tree? Etc.

You've been in this group long enough to know that it's not full of
psychics.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://BrownMath.com/
http://OakRoadSystems.com/
Shikata ga nai...
  #10  
Old August 31st 17, 03:53 PM posted to alt.windows7.general
Char Jackson
external usenet poster
 
Posts: 10,449
Default Delete many empty directories

On Thu, 31 Aug 2017 00:13:58 -0700, masonc
wrote:

On Tue, 29 Aug 2017 15:45:57 -0500, Char Jackson
wrote:

On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


I've been using RED (Remove Empty Directories) for quite a few years and
haven't had any problems with it. It's freeware.

http://www.jonasjohn.de/red.htm


Thanks for the RED suggestion. Seems to work wonders. Removed a
thousand empties. ---
However, I quickly hit "Exit" when it scanned 1193 empty among 30873
files in my *System plus Programs C:* Scared me.
Thanks again.


I've never used it from the root of a drive, so that's probably scary.
It's a handy little program. I'm glad you like it.

--

Char Jackson
  #11  
Old September 2nd 17, 05:42 AM posted to alt.windows7.general
Diesel
external usenet poster
 
Posts: 937
Default Delete many empty directories

Char Jackson
Tue, 29 Aug 2017
20:45:57 GMT in alt.windows7.general, wrote:

On Tue, 29 Aug 2017 11:11:35 -0700, masonc
wrote:

Is there any way to batch delete many empty sub-directories?
(RD empties* doesn't work)


I've been using RED (Remove Empty Directories) for quite a few
years and haven't had any problems with it. It's freeware.

http://www.jonasjohn.de/red.htm



I snagged the portable version. Many thanks!


--
https://tekrider.net/pages/david-brooks-stalker.php
http://picpaste.com/B4rjEFK0.jpg - David and Trisha
http://picpaste.com/U5np7XvN.jpg - RIAA love David style
http://picpaste.com/rjIb8Mht.jpg - David And Trisha introducing Nick!
http://bughunter.it-mate.co.uk/bdemail1.zip - The *STALKING* begins.

One workman asks another, "How long have you been working here?"
The other one replies, "Since they threatened to fire me."
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 10:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.