폴더를 자동으로 만들고 다음 첫 번째 숫자를 기반으로 파일을 정렬하는 폴더를 만들려고합니다. 정렬해야하는 파일은 모두 2 월 4 2.3 U # 03 (3) .mrd과 같은 형식으로 나타납니다. 내 의도는 AppleScript를 써서 숫자 (2.3)를 기반으로 폴더를 만든 다음 (2.3)을 포함한 모든 파일을 해당 폴더에 넣고 다른 모든 파일과 동일하게 작성하는 것이 었습니다. AppleScript를 사용하여 첫 번째 숫자를 기준으로 새 폴더에 파일 정렬
나는 작동하는 것 같다 그들의 수를 기준으로 파일을 정렬 조금set text item delimiters to {" "}
tell application "Finder"
set aList to every file in folder "Re-namer"
repeat with i from 1 to number of items in aList
set aFile to (item i of aList)
try
set fileName to name of aFile
set firstPart to text item 1 of fileName
set secondPart to text item 2 of fileName
set thirdPart to text item 3 of fileName
set fourthPart to text item 4 of fileName
set fifthPart to text item 5 of fileName
set newName to thirdPart & " " & secondPart & " " & firstPart & " " & fourthPart & " " & fifthPart
set name of aFile to newName
end try
end repeat
end tell
지금 난 그냥 첫 번째 숫자에 따라 새 폴더를 만들고에 일치하는 파일을 둘 필요했다. I를 이것에 대한 스크립트가 너무 만들려고 (내가 전에 코딩 적이 명심하고 내가 뭘하는지 아무 생각이 없음) 및 당연히 작동하지 않았다 :(
tell application "Finder"
open folder "Re-namer"
set loc to folder "Re-namer"
set aList to every file in loc
repeat with i from 1 to number of items in aList
set aFile to (item i of aList)
if not (exists folder named "text item 1" in loc) then
make new folder in loc with properties {name:"text item 1"}
else
move aFile in folder "text item 1"
end if
end repeat
end tell
을 내가 몇 가지를 발견했습니다 비슷한 질문이지만 여전히 작동하도록 할 수는 없습니다. 누구든지이 질문에 도움이되는 아이디어 나 자원이 있다면 나는 크게 그것을 appreaate 것입니다.
당신의 접근 방식은 초급자에게 좋습니다. 오픈 폴더 "리 네이머"라고 말하는 대신 그 폴더에 대한 경로를 제공해야합니다. 나는 그것에 대한 언급을 보지 못했다. –