- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cannot delete recursive directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 12:28 AM
05-20-2008 12:28 AM
cannot delete recursive directory
I have one directory with a lot of recursive directories...
core/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/..../core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237
I have prove to remove with the inum
find . -inum 1233 -exec rm -r {}\;
, but it does not work. I have prove to remove with rm -r
rm -r core
, but it does not works ok. The two commands saids: "pwd: File name too long"
Could anyone help me?
Thanks,
Carmen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 12:36 AM
05-20-2008 12:36 AM
Re: cannot delete recursive directory
find . -inum 1233 -exec rm -r {} \;
But before you use rm, try listing the files by ll and once you are confirmed that the files are ok to be deleted, then use.
Your issue was that you omitted a space in between the {} and \
Rgds.
Rasheed Tamton.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 01:15 AM
05-20-2008 01:15 AM
Re: cannot delete recursive directory
Try
Inodes are only unique to one filesystem!
# find /your_filesystem -inum 1233 | xargs rm
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 01:48 AM
05-20-2008 01:48 AM
Re: cannot delete recursive directory
Its not possible.
find . -inum 1233 |xargs rm -r
cannot open ./core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/core_16237/: No such file or directory
pwd: Too many open files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 01:50 AM
05-20-2008 01:50 AM
Re: cannot delete recursive directory
When doing -inum there will only be the one file/directory, so why use xargs?
An if you want performance with find you should use a "+":
find . -inum 1233 -exec rm -r {} +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 01:58 AM
05-20-2008 01:58 AM
Re: cannot delete recursive directory
--
Too many open files
--
You running into a kernel parameter limit or a ulimit problem, could post the the output of "ulimit -a" and your current kernel parameters settings for below parameters.
maxfiles
maxfiles_lim
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 02:16 AM
05-20-2008 02:16 AM
Re: cannot delete recursive directory
Im not going to argue all remarks you make in the threads, because I feel this is not the intent of this forum.
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 03:29 AM
05-20-2008 03:29 AM
Re: cannot delete recursive directory
pwd: Too many open files
The last time this happened to me, I had to descend into the directory tree way down then remove the files from a subtree using "rm -rf .".
Once this is done, you can restart at the top.
>Robert-Jan: the inode can still be a directory with too many files for the shell to remove (exceeding the command line's maximum length)
That can't happen, the shell isn't involved, only rm(1). The result of "find . -inum" is likely to be just one file. So you are executing:
rm -r long-directory-path
This should fit in the shell's command line.
Note: "rm -r" doesn't recursively fork/exec itself to remove the files. The recursion is within the process. Obviously rm(1) can't handle this tree as is but neither would using xargs(1) and then rm(1).
>using xargs or find ... + will bypass the shell limits.
Naturally but this trick isn't needed when using "-inum".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 03:33 AM
05-20-2008 03:33 AM
Re: cannot delete recursive directory
I have increase it,
# ulimit -a
nofiles(descriptors) 64
to
nofiles(descriptors) 8192
but it aborts again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 03:35 AM
05-20-2008 03:35 AM
Re: cannot delete recursive directory
its anyone to eliminate de lost+found and recreate again??
Thanks!
Carmen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 03:37 AM
05-20-2008 03:37 AM
Re: cannot delete recursive directory
ncheck -F vxfs /dev/vg??/rlvol?|grep 1233
ll -i /dir |grep 1233
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 03:58 AM
05-20-2008 03:58 AM
Re: cannot delete recursive directory
Thanks,
1233 /lost+found/#1233/.
478465 /lost+found/#1233/core_16237/core_16237/core_16237/.
227910 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/core_16237/core_16237/core_16237/core_16237/core_16237/.
358858 .../#1233/core_16237/core_16237/core_16237/core_16237/core_16237/core_ 16237/core_16237/core_16237/core_16237/core_16237/core_16237/.
626633 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/.
677899 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/.
717773 /lost+found/#1233/core_16237/.
717774 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/core_16237/.
68427 /lost+found/#1233/core_16237/core_16237/.
751944 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/core_16237/core_16237/.
797513 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/core_16237/core_16237/core_16237/.
68428 /lost+found/#1233/core_16237/core_16237/core_16237/core_16237/core_162 37/core_16237/core_16237/core_16237/core_16237/.
$ls -i /disc/lost+found |grep 1233
1233 #1233
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 04:14 AM
05-20-2008 04:14 AM
Re: cannot delete recursive directory
cd /lost+found/#1233/core_16237
cd core_16237/core_16237/core_16237/core_16237
rm -rf .
If the rm fails, repeat the cd to go deeper, then repeat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 04:33 AM
05-20-2008 04:33 AM
Re: cannot delete recursive directory
> its anyone to eliminate the lost+found and recreate again??
In the case you describe, you aren't going to be able to remove from this level if you can't remove from a subordinate directory.
That said, for your information, yes. You can recreate the 'lost+found' directory in a filesystem with 'mklost+found'. See the manpages for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 06:54 AM
05-20-2008 06:54 AM
Re: cannot delete recursive directory
@Dennis: you can't remove the tree you're sitting on (rm -rf .):
>>>
cd /lost+found/#1233/core_16237
cd core_16237/core_16237/core_16237/core_16237
rm -rf .
<<<
Try instead
cd /lost+found/#1233/core_16237
cd core_16237/core_16237/core_16237/core_16237
rm -rf core_16237
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2008 12:15 PM
05-20-2008 12:15 PM
Re: cannot delete recursive directory
1233 /lost+found/#1233/.
478465 /lost+found/#1233/core_16237/core_16237/core_16237/.
It doesn't look like there is a cycle in the directories. It looks like my previous case of some script gone awry.
>Peter: @Dennis: you can't remove the tree you're sitting on (rm -rf .):
Oops, I thought rm(1) would at least try to get the others.
>rm -rf core_16237
Yes or "*" if there is only the one directory there.
Also, if the tree is really deep, you can cd 10s of directories at a time:
DD=core_16237/core_16237/core_16237/core_16237/core_16237
DD20=$DD/$DD/$DD/$DD
cd $DD20