[LUAU] RE: How do you delete over 500,000 files in a directory
Julian Yap
julian_yap at yahoo.com
Thu Nov 3 14:35:02 PST 2005
Matt,
I think that error message is because there are too many "m*" files. I
think it's possibly something to do with file handling limits. Possibly.
I'd probably do this:
> cd [directory with 500,000 m* files]
> for FILES in `find -maxdepth 1 | grep '^./mgetty'`
> do
> rm -v $FILES
> done
What that will do is find and remove files which begin with mgetty one by
one, not as a wildcard removal.
If you're feeling hesitant, I'd back up the directory first if possible.
Then instead of using the line 'rm -v $FILES', do 'rm -iv $FILES'. This
will give you an interactive removal which will prompt you before any
removal.
Later,
Julian
http://julianyap.com
-----Original Message-----
Date: Thu, 3 Nov 2005 09:23:54 -1000
From: Matt Darnell <mattdarnell at gmail.com>
Subject: [LUAU] How do you delete over 500,000 files in a directory
To: LUAU <LUAU at lists.hosef.org>
Message-ID:
<52b8ace90511031123h200510bao3eb39d6ea3966e42 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Aloha,
We have a box with over 500,000 files in a direcotry. If I try 'rm m*' I get
an error, something like 'too many arguments'
I think someone else in this situation had a method of switching to another
shell, bash is default.
All the files start with mgetty. I would like to prserve the other files in
the directory and the directories below /var/log
Anyone have any ideas?
Aloha,
Matt
More information about the LUAU
mailing list