Operating System - HP-UX
1834366 Members
2433 Online
110066 Solutions
New Discussion

Re: find error message ???

 
SOLVED
Go to solution
MikeL_4
Super Advisor

find error message ???

When running the find command I am receiving the message:
Usage: find path-list [predicate-list]

command used:
if [ -d /Apps/applmgr/product/*/*/*/log ]; then /usr/bin/find -fsonly vxfs /Apps/applmgr/product/*/*/*/log -type f -mtime +30 -exec rm -f {} \; &
fi

Can you tell me what I'm doing wrong ???

Thanks
6 REPLIES 6
Pete Randall
Outstanding Contributor
Solution

Re: find error message ???

/usr/bin/find -fsonly vxfs /Apps/applmgr/product/*/*/*/log

should be
/usr/bin/find /Apps/applmgr/product/*/*/*/log -fsonly vxfs

Pete

Pete
Patrick Wallek
Honored Contributor

Re: find error message ???

You've got to tell find where to look for the stuff you want to find as the first argument after find. I'm not sure it will work but your find should look like this:

/usr/bin/find /Apps/applmgr/product/*/*/*/log -type f -mtime +30 -fsonly vxfs -exec rm -f {} \;

I am not sure if the /Apps/applmgr/product/*/*/*/log will be a valid path for find. Try testing it first by replacing the 'rm -f' with a 'ls -l' in the -exec part of the command.

Good luck.
S.K. Chan
Honored Contributor

Re: find error message ???

It's your syntax .. try this instead ..

/usr/bin/find /Apps/applmgr/product/*/*/*/log -fsonly vxfs -type f -mtime +30 -exec rm -f {} \; &
Darren Prior
Honored Contributor

Re: find error message ???

Hi,

find requires the pathname to search down before any other arguments, as per the man page.

If you change your command to:

/usr/bin/find /Apps/applmgr/product/*/*/*/log -fsonly vxfs -type f -mtime +30 -exec rm -f {} \; &

you should have more luck. I'd test it withouth the -exec until you're happy though. You may also need to enclose the pathname in quotes, I've had issues with this before when using find / -name *.dat for example.

regards,

Darren.
Calm down. It's only ones and zeros...
MikeL_4
Super Advisor

Re: find error message ???

Right about now I am feeling rather stupid after looking over this for a couple of days and not noticing that.

Thanks..
Pete Randall
Outstanding Contributor

Re: find error message ???

Ahhh, the obvious can be elusive sometimes, can't it? Don't feel stupid - we all end up needing a second opinion at one time or another.

Cheers,
Pete

Pete