0
我想創建一個applescript來查看每個用戶配置文件中的崩潰日誌〜/ Library/Logs/DiagnosticReports ..我使用*在最後,因爲可能有.crash .spin .hang文件,我需要將它們全部複製到當前桌面到「測試」文件夾中,但我不確定這是否是正確的方式。如何查找和複製文件(如果它們存在於具有applescript的其他配置文件中)?
當我嘗試運行它,我得到
錯誤「無法讓\」 Test.txt的\「到整數類型。」從 「Test.txt的」 號-1700整數
try
do shell script "ls /users >$HOME/Desktop/Users.txt"
do shell script "mkdir ~/Desktop/Test"
end try
set b to boot volume of (system info)
set u to b & "Users"
set theFiles to paragraphs of "Test.txt"
repeat theFiles times
duplicate file u & theFiles & "~/Library/Logs/DiagnosticReports/Xxxxx*" to "~/Desktop/Test"
end repeat
感謝所有幫助。
嗨,謝謝,但這兩個腳本似乎只從當前用戶獲取日誌,我把一個崩潰日誌的另一個用戶進行測試,它沒有複製它。 – Breathable
如果您需要root權限,請以root用戶身份添加'擁有管理員權限'或運行Finder。 – user495470
對不起,但你會如何設置呢? – Breathable