Mac OS X Finder (OS 10.5)의 unix 명령 ln -s
과 동일한 기능을 사용할 수 있습니까? 터미널을 열지 않고 Finder 윈도우에서 작업하는 동안 기호 링크를 만들 수 있기를 원합니다.
터미널에서 별칭을 탐색 할 수 없기 때문에 Finder의 Make Alias
명령이 원하는 것은 아닙니다. 그러나 ln -s
로 만든 링크는 터미널과 Finder에서 탐색 할 수 있습니다.
AppleScript를 통해 Finder에서 심볼릭 링크 생성 ?
해당 링크에서 가장 관련성이 높은 스크립트는 다음과 같습니다.
on run
open {choose file with Prompt "Choose a file to create a symbolic link:" without invisibles}
end run
on open the_files
repeat with i from 1 to (count the_files)
try
set posix_path to POSIX path of (item i of the_files)
if posix_path ends with "/" then set posix_path to text 1 thru -2 of posix_path
do Shell script "ln -s " & quoted form of posix_path & " " & quoted form of (posix_path & ".sym")
end try
end repeat
end open
AppleScript Editor 에 붙여 넣고 application. 그런 다음 Finder의 도구 모음 위로 드래그하거나 dock .
SymbolicLinker 원하는 것을 정확하게 수행하며 무료입니다.
사용자가 제공 한 link 의 Applescript가 nuc 에 의해 답변되었습니다. 다음은 링크가 사라진 경우에 재생 된 애플 스크립트입니다.
주석 작성자 jonn8n이 제공 한 스크립트를 선호했는데 Macworld article 으로도 재생산되었습니다.
on run
open {choose file with Prompt ¬
"Choose a file to create a symbolic link:" without invisibles}
end run
on open the_files
repeat with i from 1 to (count the_files)
try
set posix_path to POSIX path of (item i of the_files)
if posix_path ends with "/" then set posix_path to ¬
text 1 thru -2 of posix_path
do Shell script "ln -s " & quoted form of posix_path ¬
& " " & quoted form of (posix_path & ".sym")
end try
end repeat
end open
스크립트 편집기를 사용하여 이것을 응용 프로그램으로 저장하고 응용 프로그램을 Finder 사이드 바로 끌어서 파일이나 폴더를 응용 프로그램 아이콘으로 끌어서 심볼릭 링크를 만들 수 있습니다.
Path Finder 이것을 Finder에 추가하고 더 많은 기능을 추가합니다.
Automator.app를 사용하여 bash 스크립트를 실행하는 Service 를 만듭니다. 이것은 AppleScript보다 간단하고 타사 소프트웨어를 설치하는 것보다 더 안정적입니다.
for f in "[email protected]"
do
ln -s "$f" "$f.symlink"
done
그런 다음 서비스 메뉴에서 Make Symbolic Link 명령에 액세스 할 수 있습니다.
결과:
또한 SymbolicLinker가 작동하지 않는 Snow Leopard에서 Automator를 사용하여 서비스를 생성하여 터미널 명령 또는 AppleScript를 수행하여 심볼릭 링크를 생성 할 수 있습니다.
하나 더 AS :
tell application "Finder"
repeat with f in (get selection)
set p to POSIX path of (f as text)
set p2 to POSIX path of (desktop as text) & name of f
do Shell script "ln -s " & quoted form of p & " " & quoted form of p2
end repeat
end tell
이 스크립트에서 가능한 개선 사항은 다음과 같이 Finder에서 현재 선택된 파일을 사용하도록 실행 핸들러를 변경하는 것입니다.
on run
tell application "Finder" to set sel to selection
open sel
end run
on open the_files
repeat with i from 1 to (count the_files)
try
set posix_path to POSIX path of (item i of the_files as alias)
if posix_path ends with "/" then set posix_path to ¬
text 1 thru -2 of posix_path
try
do Shell script "ln -s " & quoted form of posix_path ¬
& " " & quoted form of (posix_path & ".sym")
on error
try
do Shell script "ln -s " & quoted form of posix_path ¬
& " " & quoted form of (posix_path & ".sym") with administrator privileges
end try
end try
end try
end repeat
end open
[application] /Contents/Info.plist를 편집하여 추가 할 수도 있습니다.
<key>LSUIElement</key>
<true/>
마지막 </ dict> 직전. 즉, 앱이 백그라운드에서 실행되며 클릭했을 때 맨 앞에 나타나지 않습니다.