Operating System - Linux
1753534 Members
5432 Online
108795 Solutions
New Discussion юеВ

how to delete an entry(a directory) with too many files in it

 
SOLVED
Go to solution
ian_zhao2006
Occasional Contributor

how to delete an entry(a directory) with too many files in it

my server type is HP C3600 and the unix version HP_UX 10.20
the result of command ll for tis entry
drwxrwxr-x 2 hp3070 hp3070 3854336 Jan 4 17:02 alarm

in directory
/var/hp3070/qm/logdata/alarm,there are very large number of files in it.
I want to delete them by command
rm -rf *
a message appears on the screen like
sh: /bin/rm: The parameter list is too long.
if I use command
rm -rf 1:05060*
I can delete some files.
because the files are too many,I will delete many times to delete these files.
I wonder who can give me a help on delete these files in a short time.
thank you.

 

 

P.S. This thread has been moved from HP-UX Technical Documentation to HP-UX > languages - HP Forums Moderator

5 REPLIES 5
Peter Godron
Honored Contributor
Solution

Re: how to delete an entry(a directory) with too many files in it

Hi,
if you do not have any sub-directories under alarm, you could try:
cd /var/hp3070/qm/logdata/alarm
find . -print -exec rm {} \;

Arunvijai_4
Honored Contributor

Re: how to delete an entry(a directory) with too many files in it

# find /var/hp3070/qm/logdata/alarm -type f -print -exec rm {} \;

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Robert-Jan Goossens
Honored Contributor

Re: how to delete an entry(a directory) with too many files in it

Hi,

# cd /var/hp3070/qm/logdata/alarm
# find . -name "1:05060*" | xargs rm

Regards,
Robert-Jan
Senthil Prabu.S_1
Trusted Contributor

Re: how to delete an entry(a directory) with too many files in it

hi,
Use find for this.
find /var/hp3070/qm/logdata/alarm . -print -exec rm {} \;


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Fabio Ettore
Honored Contributor

Re: how to delete an entry(a directory) with too many files in it

Hi,

good that provided suggestions have solved your problem. Anyway that message

"The parameter list is too long."

is not a 'rm' command problem but an environment limit on the shell for HP-UX 10.20 (I suppose you are using sh-posix at this time).
That should be solved by enabling the following kernel parameter:

large_ncargs_enabled


This is a limitation of 10.20 only since it is built-in in 11.X, so you won't see it on 11.X systems.

HTH.

Best regards,
Fabio
WISH? IMPROVEMENT!