1752806 Members
5510 Online
108789 Solutions
New Discussion юеВ

shell script question

 
SOLVED
Go to solution
S Nelson_1
Occasional Contributor

shell script question

I have line in my script that I continue to recieve: find: missing conjunction

This is the line in question:
find . -path "./*" -prune -name 'A' -type d -
mtime +366 -print rm -rf {} \; >>/JDIS/JDISONLINE/cleanuplog.txt

This lines purpose is to find any directory in the current working directory specifically named: A and delete it if it's older than 1 year and send the output to a log file.

I've done a lot of searching and think i have everything quoted correctly.

When I do a set -f and run the command I still recieve the same error message.

When I do a set -x and run it this is what I recieve:
+ find . -path ./* -prune -name A -type d -mtime +366 -print rm -rf {} ;
+ 1>> /JDIS/JDISONLINE/cleanuplog.txt
find: missing conjunction

If anyone can help me shed some light on what's going on here? It will be greatly appreciated.

Thank you


no
3 REPLIES 3
smatador
Honored Contributor
Solution

Re: shell script question

Hi,
Do you have try to replace -print by -exec
Hope it helps
S Nelson_1
Occasional Contributor

Re: shell script question

Thanks that seems to have solved my problem.

Much appreciated!
no
Dennis Handly
Acclaimed Contributor

Re: shell script question

>rm -rf {} \;

You might also want to use "+" for performance: rm -rf {} +