find command on NFS is returning "creates a cycle" for a .file (dot file) (224 Views)
Reply
Occasional Advisor
kjohnsonm
Posts: 12
Registered: ‎09-14-2010
Message 1 of 2 (224 Views)

find command on NFS is returning "creates a cycle" for a .file (dot file)

after presetting Myfile and age in my script

 

find /mydir/mysubdir/ ! -name ".snapshot" -a -name "$Myfile.*.*.*.*.*" -a -mtime +$age -a -exec rm {} \;

 

Even with the exclusion of the .snapshot file I get this every time:

 

find: /mydir/mysubdir/.snapshot creates a cycle

 

I do not want to even look at this file... Can anyone help me clear this up?   I use this type of cleanup all the time on local disks and do not get any errors nor need the exculsion check...

TIA  -Keith

time is a preditor to us all, live now not in the future.
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,895
Registered: ‎03-06-2006
Message 2 of 2 (196 Views)

Re: find command on NFS is returning "creates a cycle" for a .snapshot

[ Edited ]

>I do not want to even look at this file

 

The proper find primary is -prune and if you want performance, you need "+":

find /mydir/mysubdir/ -name .snapshot -prune -o -name "$Myfile.*.*.*.*.*" -mtime +$age -exec rm {} +

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation