topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 11:52 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: How can I delete over 6,000 recursive directories?  (Read 18718 times)

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
How can I delete over 6,000 recursive directories?
« on: June 01, 2011, 04:17 PM »
Around 3-4 months ago, my wifes phone (Motorola Defy) suddenly slowed to a pathetic crawl.
It would take forever to accomplish anything. She didn't know why, but I suspected some rogue app.
I forget all the steps I took to isolate the condition, but I found that the camera would store every photo in its own directory. Plus it did the same for thumbnails.
Long terrible situation > short ... her phone no longer works.
Now, at this time, she only had her phone for about 4-5 months. TOPS!!!
She used the camera regularly, nothing outrageous.
I made a backup of her 8GB microSD card.
It was filled to the max!
WTF?

I ran Microsoft Security Essentials on this backup folder.
When it finished, it reported no issues. But it DID scan 12,408 directories.
FRIGGIN' CRAZY, RIGHT??!??!
The attached screenshot is about half way through the scan.

What's REALLY odd, I was able to delete all the photos. But the empty folders are still there.

So my question: how can I delete all these folders?
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #1 on: June 01, 2011, 04:27 PM »
Is there any software on the card?  If it's just storage, find out how to format it.  That will delete everything.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #2 on: June 01, 2011, 04:28 PM »
DelAge32, freeware by Horst Schaeffer.
DelAge32 is a command line tool that deletes or moves files by age (number of days).
[...]
/recurse   Recurse through the entire subdirectory structure (see /rd option to remove empty directories)
/subonly   Recurse, but exclude the initial directory   
/rd   Remove empty directories by age (according to "created" stamp)   
[...]

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #3 on: June 01, 2011, 04:31 PM »
Is there any software on the card?  If it's just storage, find out how to format it.  That will delete everything.

The phone no longer works. Getting it functional is beyond my intents.
The microSD card is still in the phone.

I'm wanting to delete the backed up folders from my PC.
It's spring cleaning time, and I came across them today.

@rjbull: thank you. I'll give that a try.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #4 on: June 01, 2011, 05:27 PM »
NOPE.
I extracted the contents of "delage32.zip" to a temp directory. And ran my first command:
Delage32 D:\MomPhoneBackup\*.* 10 /recurse /rd

*I didn't know if it would delete anything/everything YOUNGER or OLDER than 10 days.
So I ran it a few times with 10, 100, 1000, etc. You get the picture.

OUTPUT
D:\_TEMP\delage32>Delage32 D:\MomPhoneBackup\*.* 10 /recurse /rd
 (rd) 110327_112728\dcim\b\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camer
a\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\ *** fail
ed ***
DelAge32 - No files

D:\_TEMP\delage32>

*I didn't know ... I didn't read the directions fully till my first few attempts because I wasn't paying attention and ended up watching a movie and having lunch ... because I got distracted.
But I tried a few more times and all come up with the same results.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #6 on: June 01, 2011, 05:44 PM »
Thanks Curt.

I'll give that a shot.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Krishean

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 75
  • I like pie
    • View Profile
    • Draconis Labs
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #7 on: June 01, 2011, 05:56 PM »
tried this command?

rmdir /S /Q dirnamehere

i have also seen too many nested directories cause filesystem damage
Any sufficiently advanced technology is indistinguishable from magic.

- Arthur C. Clarke

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #8 on: June 01, 2011, 05:57 PM »
another NOPE.
It doesn't even show the directories.

To make sure I was using it right, I made a bunch of embedded directories, and ran the app.
It showed and removed those with no problem.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #9 on: June 01, 2011, 06:17 PM »
Have you made sure you have the necessary permissions for the directories in question? Taken ownership of them etc.?

rmdir /S /Q dirnamehere

hehe Been awhile since I've had to use that one for anything. It might not hurt to try this also:

rmdir /Q /S \\.\C:\Target_Folder

Had to use that on a few hidden directory FTP server cleanups (back in the day).

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #10 on: June 01, 2011, 06:19 PM »
+1 with Krishean.

I've also seen too many nested directories (or too long a path) screw up a file system beyond repair.

Your best bet might be to just copy over anything you still want and then reformat the SD card.

Luck! :Thmbsup:

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #11 on: June 01, 2011, 07:07 PM »
Your best bet might be to just copy over anything you still want and then reformat the SD card.

Luck! :Thmbsup:
I have already DONE that.
The card has since remained IN the phone. I'm not worried at ALL about the condition of the card nor the phone.

I'm asking for help to remove these items from their BACKUP LOCATION on my PC. por favor :P


Everything I've been recommended to do above has been done, with no effect to anything.
----- ----- ----- ----- -----

D:\MomPhoneBackup\dcim\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\Camera\

That's where I was a few hours ago.
Everything attempted via command line results with a message about the filename being too long.
So I've manually gone and done this:

D:\MomPhoneBackup\1\2\3\4\5\6\7\8\9\0\1\2\3\4\5\6\7\8\9\0\1\2\3\4\5\6\7\8\9\0\1\2\3\4\5\6\7\8\9\0\1\2\3\4\5\6\7\8\9\0\1\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\Camera\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\33\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\1>

Now all the above directories are EMPTY.
I am renaming all "/Camera/" folders to single-digits. Each Camera folder has ninety-something JPG files in them.

Using the above mentioned command: "rmdir /S /Q dirnamehere" does nothing.
Then I started renaming the "/Camera/" folders and deleting the photos: del *.jpg

I've got (I lost count) X folders deep, and now my commands say:
The system cannot find the path specified.
The file name is too long.

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

I'm currently in a folder and can not delete any photos, nor can I rename the Camera folder.
This is proving to be a real pain in the butt.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #12 on: June 01, 2011, 07:22 PM »
can you delete from the bottom up?

if you can delete 1, try 5, then 10, etc and see if you can get it down to something reasonable


Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #13 on: June 01, 2011, 07:32 PM »
can you delete from the bottom up?

if you can delete 1, try 5, then 10, etc and see if you can get it down to something reasonable


I'e tried that at the root of the folder, middle, and at the end.
At the end, where the last Camera folder is at, and also where the photo files are, I'm not able to delete them.

When I try to delete them via command line, it says: The system cannot find the path specified.
When I try to delete them via Explorer window, it says: The name(s) were too long for the destination folder. You can shorten the file name and try again.

That's why I renamed all the original '/Camera/' folders to single numerals.
It actually DID help, as I was able to navigate further than before.

I'm stuck now, because all I've tried no longer works.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #14 on: June 01, 2011, 07:48 PM »
what about booting into a live rescue or linux distro?

I'm not a Linux user (too lazy) but isn't this the sort of thing they're meant for?

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #15 on: June 01, 2011, 08:05 PM »
I'm asking for help to remove these items from their BACKUP LOCATION on my PC. por favor
-Jammo the OrganizedFellow (June 01, 2011, 07:07 PM)

Sorry. Must have missed that part.  :-[


what about booting into a live rescue or linux distro?

I'm not a Linux user (too lazy) but isn't this the sort of thing they're meant for?

Yes they are. Any 'live' Linux distro will work. It doesn't have to be a rescue release. The file manager in Puppy or one of the mini distros should work equally well. I've done that when a Macintosh directory was copied onto an external HD, and Windows Explorer and the command line couldn't delete certain files because the path/name was too long; or contained a character not allowed (e.g. / \ * etc.) under Windows. PartedMagic is a good Swiss Army type utility disk to have for this sort of thing.

 :Thmbsup:
« Last Edit: June 01, 2011, 08:18 PM by 40hz »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #16 on: June 01, 2011, 08:15 PM »
Yes they are. Any 'live' Linux distro will work. It doesn't have to be a rescue release. The file manager in Puppy or one of the mini distros should work equally well.

yeah, I figured as much, though I thought a rescue distro may make the process easier (by including appropriate ready to use apps)

PartedMagic is a good Swiss Army type utility disk to have for this sort of thing.

Parted Magic does file operations?

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #17 on: June 01, 2011, 08:22 PM »
PartedMagic[/b] is a good Swiss Army type utility disk to have for this sort of thing.
Parted Magic does file operations?

Latest version has a bunch of file tools including PCManFM.  Above link goes to a page with full details.  Check it out. It's not your granddaddy's Parted Magic CD!  ;D  :Thmbsup:

« Last Edit: June 01, 2011, 08:27 PM by 40hz »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #18 on: June 01, 2011, 08:31 PM »
Latest version has a bunch of file tools including PCManFM.  Above link goes to a page with full details.  Check it out. It's not your granddaddy's Parted Magic CD!  ;D  :Thmbsup:

cool - I've had copies of this in my toolkit for years, though I rarely have a need for it so it doesn't get updated that often (it's been quite a while :Thmbsup:)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #19 on: June 01, 2011, 10:01 PM »
I haven't tried this script.  But you can take a look:

http://www.sevenforu...e/29234-deltree.html

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #20 on: June 02, 2011, 12:18 AM »
try this and see if it helps, Remove Empty Directories aka RED.



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

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #21 on: June 02, 2011, 01:06 AM »
I'm not able to boot to a LiveCD because the last time I tried one, I couldn't use my wireless Logitech keyboard.
I'm sure I would have to be hard-wired in, right? Is that the right term?

I tried this http://www.jonasjohn.de/lab/red.htm posted by lanux128.
It didn't work.

MilesAhead posted this http://www.sevenforu...e/29234-deltree.html
I'm not comfortable playing with a VB script :(
----- ----- ----- ----- -----
"You can download Ubuntu and run it alongside your current Windows system."

So I'm gonna give it a shot.
It's supposed to be as easy as installing and uninstalling a Windows app.


I've played with Ubuntu years years ago.
It was always pretty good at detecting my hardware. I just hope it's still as good :)

I'll report back.
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____
« Last Edit: June 02, 2011, 01:08 AM by Jammo the OrganizedFellow »

Jammo the OrganizedFellow

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 212
    • View Profile
    • OrganizedFellow
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #22 on: June 02, 2011, 01:41 AM »
SUCCESS!!!!!!!!!!!!!!!!!

As I've used Ubuntu in the past, I've also used EasyBCD http://neosmart.net/dl.php?id=1
and I'm pretty sure that all I really needed was iReboot http://neosmart.net/dl.php?id=11

I've rebooted into Ubuntu (I feel right at home) and knew instantly where to go to delete that damned directory.
:D :P :)

THANK YOU for the recommendations fellas!!!
As an aspiring web developer/designer, it is a constant struggle to cope with my ADHD + Hypomania/Bipolar Disorder.

The slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

X_____jamjammo_____
« Last Edit: June 02, 2011, 05:16 PM by Jammo the OrganizedFellow »

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #23 on: June 02, 2011, 04:31 PM »
NOPE.
I extracted the contents of "delage32.zip" to a temp directory. And ran my first command:
Delage32 D:\MomPhoneBackup\*.* 10 /recurse /rd
[...]
DelAge32 - No files
[...]
But I tried a few more times and all come up with the same results.
-Jammo the OrganizedFellow (June 01, 2011, 05:27 PM)

It's meant for deleting files over a given age.  You may need to wrap the path in double quotes, if the path has spaces in it.  I.e.,

D:\Here it is\*.*

would probably fail, but

"D:\Here it is\*.*"

should work (I think).  I certainly had to use quotes round UNC paths.  You may also have run into a command line that's just too long for Windows/DOS to accept: there's a limit, though I can't remember just what it is.

Examples of command lines that worked for me:
c:\dos\utils\delage32 g:\pcw\bak\*.7z 60
Straightforward, there isn't a space in the path
c:\dos\utils\delage32 "\\GBRCSFBZ001\Groups\Technical\Library\Newsletter\Newsletter_*.pdf" 60
with UNC path
c:\dos\utils\delage32.exe "c:\Documents and Settings\robertbull\Local Settings\Temp\ev_client_log_*.txt" 1 /includeRO /includeH /quiet
both worked, and that last one does have spaces in the path.  I used these examples in batch files for automated clean-ups, using PowerPro's scheduler.

Another thought; shouldn't most file managers do what you want without fuss?  Total Commander certainly will.  You have to press OK the first time if it thinks there's something inside the top-level directory you're deleting, including empty child directories, but only the once.  It isn't free as delage32 is, but it's modestly priced, and one of the best-value file managers out there, as well as one of the very best file managers anywhere.  It was the first thing that made using Windows almost semi-tolerable for this old-time DOS person.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: How can I delete over 6,000 recursive directories?
« Reply #24 on: June 02, 2011, 04:47 PM »
Here's the MS way to do it from command line:

http://support.microsoft.com/kb/930527

Skip past the stuff about using Disk Cleanup. At the bottom it has the steps for command line to get permissions then delete folder with all subfolders and contents.

At least that's what they say.
I imagine it should work as long as your flavor of Windows has takeown.exe installed.
« Last Edit: June 02, 2011, 04:52 PM by MilesAhead »