2012-03-11 3 views
1

이름 목록을 사용하여 폴더 집합을 만드는 AppleScript를 만들려고합니다. 그런 다음 선택된 폴더의 파일을 새로 생성 된 각 폴더에 복사합니다.새 파일의 폴더에 여러 파일 복사 appelscript

답변을 검색했지만 이해하지 못했습니다. 그래서 코드를 변경해야하는 이유와 이유를 설명하기가 너무 친절하다면 저에게는 훌륭한 학습 경험이 될 것입니다. 업데이트 미리 에서

set destinationFolder to choose folder 
set {text returned:textReturned} to display dialog "enter folder names" default answer   return & return & return 
if textReturned is "" then return 
set folderWithFiles to (choose folder with prompt "Where are the files at?") 
repeat with aLine in (get paragraphs of textReturned) 
if contents of aLine is not "" then 
    do shell script "/bin/mkdir -p " & quoted form of (POSIX path of dest inationFolder & aLine) 
    set folderNew to aLine & ":" as alias 
    set dest to folderNew on destinationFolder -- as alias 
    tell application "Finder" 
     duplicate every file of folderWithFiles to dest 
    end tell 
end if 
end repeat 

감사 : 자신에 게시 대답

+0

을 따라서. 내가 답을 찾았을 때 나는 대답을 올릴 수 있기까지 5 시간을 기다려야했다. 그리고 또 다른 48 명은 그것을 받아 들일 수 있습니다. 그래서 인내심 소년들. – Runar

+0

결국이 질문으로 무언가를 배웠습니다 ... – adayzdone

답변

1
다음

macscripter.net

에서 StefanK에서

있어 도움이 완전한 코드 : 모든 계획을했다

set destinationFolder to choose folder 
set {text returned:textReturned} to display dialog "enter folder names" default answer return & return & return 
if textReturned is "" then return 
try 
    set theFiles to (choose file with prompt "Where are the files at?" with multiple selections allowed) 
end try 
repeat with aLine in (get paragraphs of textReturned) 
    if contents of aLine is not "" then 
     set newFolder to (destinationFolder as text) & aLine 
     do shell script "/bin/mkdir -p " & quoted form of POSIX path of newFolder 
     try 
      tell application "Finder" to duplicate theFiles to folder newFolder 
     end try 
end if 
end repeat 
관련 문제