Unix Technical Forum

rm : file argument too long

This is a discussion on rm : file argument too long within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> Hi all, One of my users created a recursive directory until the system limit (we're running Solaris8). No I'm ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2008, 07:19 AM
Thillier Pierre-Yves \(IFF DCSA IT\)
 
Posts: n/a
Default rm : file argument too long

Hi all,

One of my users created a recursive directory until the system limit (we're
running Solaris8).
No I'm trying to remove this famous recurisve directory and I'm having each
time an error message : file argument too long
The problem is the same with also mv, find ... commands

Is there anybody having a hint for this issue ?

Thanks in advance and best regards,

Pierre-Yves Thillier
Infineon Technologies


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 07:19 AM
Beardy
 
Posts: n/a
Default Re: rm : file argument too long

Thillier Pierre-Yves (IFF DCSA IT) wrote:
> Hi all,
>
> One of my users created a recursive directory until the system limit (we're
> running Solaris8).
> No I'm trying to remove this famous recurisve directory and I'm having each
> time an error message : file argument too long
> The problem is the same with also mv, find ... commands
>
> Is there anybody having a hint for this issue ?
>
> Thanks in advance and best regards,
>
> Pierre-Yves Thillier
> Infineon Technologies
>
>


This one was posted a while back (creds to Mark Hittinger), and received
critical acclaim for its elegance. You will need to modify it as it was
originally designed to blow away an Oracle recursive core directory, but
you will get the picture from the script.


>> #! /bin/sh
>> renice 5 $$
>> while [ 1 ] ; do
>> mv core_8286 core_8286.rm
>> if [ $? -ne 0 ] ; then exit ; fi
>> mv core_8286.rm/core_8286 .
>> if [ $? -ne 0 ] ; then exit ; fi
>> rmdir core_8286.rm
>> if [ $? -ne 0 ] ; then exit ; fi
>> done



>> After one pass you have the same directory tree in core_8286 but

with the top level snipped off.
>> It could just grind away in the background until it hits the bottom.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-12-2008, 07:19 AM
Thillier Pierre-Yves \(IFF DCSA IT\)
 
Posts: n/a
Default Re: rm : file argument too long

Thanks for the quick answer !!
That worked fine.

Have a nice day,

Pierre-Yves
"Beardy" <beardy@beardy.net> wrote in message
news:K8oWb.2520$Y%6.381445@wards.force9.net...
> Thillier Pierre-Yves (IFF DCSA IT) wrote:
> > Hi all,
> >
> > One of my users created a recursive directory until the system limit

(we're
> > running Solaris8).
> > No I'm trying to remove this famous recurisve directory and I'm having

each
> > time an error message : file argument too long
> > The problem is the same with also mv, find ... commands
> >
> > Is there anybody having a hint for this issue ?
> >
> > Thanks in advance and best regards,
> >
> > Pierre-Yves Thillier
> > Infineon Technologies
> >
> >

>
> This one was posted a while back (creds to Mark Hittinger), and received
> critical acclaim for its elegance. You will need to modify it as it was
> originally designed to blow away an Oracle recursive core directory, but
> you will get the picture from the script.
>
>
> >> #! /bin/sh
> >> renice 5 $$
> >> while [ 1 ] ; do
> >> mv core_8286 core_8286.rm
> >> if [ $? -ne 0 ] ; then exit ; fi
> >> mv core_8286.rm/core_8286 .
> >> if [ $? -ne 0 ] ; then exit ; fi
> >> rmdir core_8286.rm
> >> if [ $? -ne 0 ] ; then exit ; fi
> >> done

>
>
> >> After one pass you have the same directory tree in core_8286 but

> with the top level snipped off.
> >> It could just grind away in the background until it hits the bottom.

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-12-2008, 07:19 AM
Yura Pismerov
 
Posts: n/a
Default Re: rm : file argument too long


Would "find -type d ... | xargs rmdir" help in this case ?

Thillier Pierre-Yves (IFF DCSA IT) wrote:
> Hi all,
>
> One of my users created a recursive directory until the system limit (we're
> running Solaris8).
> No I'm trying to remove this famous recurisve directory and I'm having each
> time an error message : file argument too long
> The problem is the same with also mv, find ... commands
>
> Is there anybody having a hint for this issue ?
>
> Thanks in advance and best regards,
>
> Pierre-Yves Thillier
> Infineon Technologies
>
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-12-2008, 07:19 AM
Beardy
 
Posts: n/a
Default Re: rm : file argument too long

Thillier Pierre-Yves (IFF DCSA IT) wrote:
> Thanks for the quick answer !!
> That worked fine.
>
> Have a nice day,
>
> Pierre-Yves


Excellent! Glad to be of assistance :-)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-12-2008, 07:19 AM
Barry Margolin
 
Posts: n/a
Default Re: rm : file argument too long

In article <c0d9h2$ciq$1@bfos.tucows.com>,
Yura Pismerov <ypismerov@tucows.com> wrote:

> Would "find -type d ... | xargs rmdir" help in this case ?


That has two problems:

1) It will try to delete the parent directories before deleting the
child directories, which will fail because they're not empty. This can
be resolved by using the -d or -depth option, if your version of find
has it, to do a depth-first traversal.

2) It doesn't address the "filename too long" problem at all. The
deeply nested directory will still have a huge name, since find prints
out the full pathname.

You seem to be confusing the OP's problem with the more common problem
of too many arguments on the command line. That's the type of problem
that piping find to xargs solves.

If your version of find has the -execdir option (it's in GNU find), I
think the following might be a solution:

find topdir -depth -type d -execdir rm -r {} \;

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-12-2008, 07:19 AM
Yura Pismerov
 
Posts: n/a
Default Re: rm : file argument too long


Thanks for correction.
BTW, Solaris find does support depth (at least starting from Solaris 7 -
I have no 2.6 to verify).


Barry Margolin wrote:
> In article <c0d9h2$ciq$1@bfos.tucows.com>,
> Yura Pismerov <ypismerov@tucows.com> wrote:
>
>
>> Would "find -type d ... | xargs rmdir" help in this case ?

>
>
> That has two problems:
>
> 1) It will try to delete the parent directories before deleting the
> child directories, which will fail because they're not empty. This can
> be resolved by using the -d or -depth option, if your version of find
> has it, to do a depth-first traversal.
>
> 2) It doesn't address the "filename too long" problem at all. The
> deeply nested directory will still have a huge name, since find prints
> out the full pathname.
>
> You seem to be confusing the OP's problem with the more common problem
> of too many arguments on the command line. That's the type of problem
> that piping find to xargs solves.
>
> If your version of find has the -execdir option (it's in GNU find), I
> think the following might be a solution:
>
> find topdir -depth -type d -execdir rm -r {} \;
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com