我真的很希望有人能幫助我解決這個問題。我最近從一個mac移到另一個,並做了一個乾淨的安裝。我有幾個有數百個別名的文件夾(你怎麼說別名的複數?)...如何在遷移後在mac上修復100個別名?
原始文件路徑是「/ Volumes/Media Drive/Ableton/Warped Tracks /」,而新路徑需要成爲「/用戶/ joel /音樂/ Ableton項目/扭曲曲目」
我看到如何解決他們一次一個,但這將需要幾個小時。我試過這個applescript,但沒有運氣: https://apple.stackexchange.com/questions/2656/how-do-i-fix-failed-aliases
任何人都可以給我一個更好的applescript或另一種解決方案嗎?正如我所提到的,我試過這個applescript:
tell application "Finder"
set these_items to the selection
end tell
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items) as alias
set this_info to info for this_item
if class of this_item is alias then
tell application "Finder"
set original_file to original item of this_item
set this_alias_file_name to displayed name of this_item
set container_folder to container of this_item
set the_path to the POSIX path of (original_file as alias)
set new_path to my replaceText("/Volumes/Media Drive/Ableton/Warped Tracks/", "https://stackoverflow.com/users/joel/Music/Ableton Projects/Warped Tracks", the_path)
move this_item to trash
try
make new alias file at container_folder to (POSIX file new_path) with properties {name:this_alias_file_name}
on error errMsg number errorNumber
if errorNumber is -10000 then -- new original file not found, try relinking to old
try
make new alias file at container_folder to (POSIX file the_path) with properties {name:this_alias_file_name}
on error errMsg number errorNumber
if errorNumber is -10000 then -- old original not found. link's dead Jim
display dialog "The original file for alias " & this_alias_file_name & " was not found."
else
display dialog "An unknown error occurred: " & errorNumber as text
end if
end try
else
display dialog "An unknown error occurred: " & errorNumber as text
end if
end try
end tell
end if
end repeat
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
任何幫助將不勝感激。
編輯:我認爲對我來說,蘋果筆記本電腦的問題是,我有更多的文件夾下的路徑都是不同的,每個包含單獨的別名文件。 IE: 「/ users/joel/Music/Ableton Projects/Warped Tracks/Folder A/file.alias」,/ users/joel/Music/Ableton Projects/Warped Tracks/Folder B/file2.alias「等等,等等
[看起來有人在這裏解決了這個問題](http://apple.stackexchange.com/a/86549) – davidcondrey
@davidcondrey,謝謝你的回覆。這是我上面發佈的鏈接。在答案中提供的applescript對我來說不起作用 - 我應該說,applescript不適合我,我不知道Ruby的第一件事。 : -/ – Joel
你還有原始卷「/ Volumes/Media Drive/Ableton/Warped Tracks /」以及別名指向的所有原始文件嗎? –