Operating System - HP-UX
1834154 Members
2028 Online
110064 Solutions
New Discussion

Re: rm files from directory

 
SOLVED
Go to solution
Anthony khan
Frequent Advisor

rm files from directory

Hi ALL,

I am try to remove files from the directory, so I am run following command,

find /var/spoo/uucp/spec01ea -mtime +10 -exec rm {} \;

I am getting the following error

find: cannot stat /var/spool/spec01ea

There are more then 4000 files, and the system generate 2 files every 5 minutes.

Any suggestion how can i do this.

Thanks
4 REPLIES 4
D. Jackson_1
Honored Contributor
Solution

Re: rm files from directory

Try this :
find /var/spoo/uucp/spec01ea* -mtime +10 -exec rm {} \;

HTH
Helen French
Honored Contributor

Re: rm files from directory

hey,

This problem occurs when access rights to a directory
have been denied.

R u running as a root? Also check the path for mistakes !

Go to that directory and see whether you can delete those files. or try this:

# cd dir_path
# find . -mtime +10 -exec rm {} \;

HTH,
Shiju
Life is a promise, fulfill it!
Sachin Patel
Honored Contributor

Re: rm files from directory

Hi Anwar
Try
#cd
#find . -mtime +10 .....
as root

Sachin
Is photography a hobby or another way to spend $
Roger Baptiste
Honored Contributor

Re: rm files from directory

Hi,

Cannot stat error is related to a broken/corrupted directory/file structure.
Just do
# find >/tmp/test

This will confirm what files are actually accessible in the directory.

Regarding removing the files:
you can do it faster by using xargs instead of exec:

find -mtime +10 | xargs rm

Another thing, if your idea is to clear space in /var/spool immediately, what you can do is
#mv

This will free up space in /var/spool and then you can
run the remove command on the other filesystem.

HTH
raj
Take it easy.