find command on NFS is returning "creates a cycle" for a .file (dot file) (277 Views)
Reply
Advisor
kjohnsonm
Posts: 13
Registered: ‎09-14-2010
Message 1 of 2 (277 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.
Acclaimed Contributor
Dennis Handly
Posts: 25,284
Registered: ‎03-06-2006
Message 2 of 2 (249 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 {} +

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.