• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3215
  • Last Modified:

Remove Directory With Infinite Sub Directories

Without having to reformat the harddisk, how can i remove a directory with subdirectories, for example m/m/m/m/m/m/m/m............/m/m/m/m/m (more than 300 levels)?

Thanks.
0
aimui
Asked:
aimui
1 Solution
 
ozoCommented:
rm -r
0
 
aimuiAuthor Commented:
I have used this command but i get the error message : File name too long!
0
 
helverCommented:
Try going halfway down the tree and running the command ozo gave you.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
n0thingCommented:
There's a few ways to do this.
1- You could find the inode of the dir and write a little
C program or perl to unlink the inode.
2- Try to do a find with the -exec rm arg, not sure this
will work. find will recurse into the subdir and hopefully
the -exec rm args will work at these sub levels.
3- mv dirname /dev/null - Not sure if this work. :))

0
 
tfabianCommented:
from the top level directory


  rm -R directory name

the -R should be in capital letters


0
 
toToCommented:
while test -d m; do cd m; done
cd ..
while test -d m; do rmdir m; cd ..; done
0
 
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  Or if you are an EE Pro user, click the link below to select open items for your Member ID using Power Search:
http://www.experts-exchange.com/jsp/qPowerSearch.jsp.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now