Parece um bug na forma como o predicado -lname
é testado, e é muito mais estranho do que simplesmente não ser recursivo. Do meu teste, parece funcionar apenas em arquivos na mesma profundidade de diretórios que o diretório de trabalho atual (ou seja, você estava em ~ / Documents e executava find .. -lname '/Volumes*'
, encontrava links em ~ / Documents e ~ / Desktop, etc mas não quaisquer links em ~). Mas há (pelo menos de acordo com meus testes) uma solução alternativa: parece funcionar se o diretório inicial for um caminho absoluto, portanto, usar find "$PWD" -lname '/Volumes*'
em vez de find . -lname '/Volumes*'
parece evitar o problema. Aqui está uma sequência de testes para ilustrar isso:
Mac:~ test$ mkdir -p sub1/subsub1 # Create some folders and links to work with
Mac:~ test$ mkdir -p sub2/subsub2
Mac:~ test$ ln -s sometarget toplink
Mac:~ test$ ln -s sometarget sub1/sub1link
Mac:~ test$ ln -s sometarget sub1/subsub1/subsub1link
Mac:~ test$ ln -s sometarget sub2/sub2link
Mac:~ test$ ln -s sometarget sub2/subsub2/subsub2link
Mac:~ test$ find . -lname "*" # This only finds links at the top of the home directory
./toplink
Mac:~ test$ cd sub1
Mac:sub1 test$ find . -lname "*"
./sub1link
Mac:sub1 test$ find .. -lname "*" # This only finds links one level down
../Pictures/iChat Icons
../sub1/sub1link
../sub2/sub2link
Mac:sub1 test$ cd subsub1
Mac:subsub1 test$ find ../.. -lname "*" # This only finds links two levels down
../../sub1/subsub1/subsub1link
../../sub2/subsub2/subsub2link
Mac:subsub1 test$ find ../.. -lname "*" -o -name "*sub2*" # The -name predicate works fine
../../sub1/subsub1/subsub1link
../../sub2
../../sub2/sub2link
../../sub2/subsub2
../../sub2/subsub2/subsub2link
Mac:subsub1 test$ find /Users/test -lname "*" # It works as expected with an absolute starting path
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.AddressBook
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.Dashboard
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.Dock
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.iCal
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.Keychain
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.Mail
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.PreferenceSync
/Users/test/Library/Application Support/SyncServices/Local/clientdata/com.apple.Safari
/Users/test/Pictures/iChat Icons
/Users/test/sub1/sub1link
/Users/test/sub1/subsub1/subsub1link
/Users/test/sub2/sub2link
/Users/test/sub2/subsub2/subsub2link
/Users/test/toplink
Vou enviá-lo para o bugreporter da Apple.