2012-03-12 12 views
1

DNG/XMP 파일을 관리하는 데 도움이되는 자동화 작업을 만들고 싶습니다. DNG 및 일치하는 XMP 파일을 휴지통으로 보낼 작업에 DNG (또는 여러 개)를 끌 수 있어야합니다. 파일은 확장자를 제외하고 같은 이름을 가지며 동일한 디렉토리에 있습니다. 예를 들어, IMGP1361.DNG 및 IMGP1361.xmpAutomator/AppleScript가 동일한 디렉토리에서 동일한 확장자를 가진 동일한 파일 이름을 찾습니다.

이것은 쉘 스크립트에 대한 간단한 작업이지만 Automator에 대한 자세한 내용은 Automator가 있습니다. 입력 찾기 항목의 파일 이름을 가져 와서 변수에서 변경하고이를 다른 작업의 입력으로 사용할 수 있습니까?

감사합니다.

+0

AppleScript를 작성하는 것은 쉽지만 (필자는 Automator 워크 플로우에 임베드 할 수는 있지만 할 필요는 없지만) 요점을 실제로 볼 수는 없습니다. 왜 Finder보기를 파일 이름별로 정렬하지 않고 제거하려는 모든 파일을 선택하고 cmd + baskspace를 누르십시오. – fanaugen

+0

좋은 질문 - EyeFi 카드를 통해 업로드 된 이미지로 가득 찬 디렉토리를 스크롤하고 저장하고 싶지 않은 파일을 끌어 와서 삭제할 일치하는 XMP 파일을 찾는 것에 대해 걱정할 필요가 없습니다. XMP 파일을 스크롤하지 않아도 됨). –

답변

1

OK, 알겠습니다. 당신은이 같은 자동화 워크 플로우 내에서 아래의 애플 스크립트 사용할 수 있습니다 : 확장자가 ext_list에있는 경우 Finder에서 모든 선택 파일에 대해

Automator workflow

를, 그것은 휴지통으로 이동하고, 그렇게 될 것입니다 확장자가 also_these_extensions 인 같은 폴더에 같은 이름의 다른 모든 파일이 있습니다.

보조 LaTeX 파일이있는 폴더를 청소하는 경우에도 "tex"ext_list에 넣고 다른 모든 확장자 (예 : "aux", "dvi", "log")를 also_these_extensions에 넣으십시오.

선택한 파일이 동일한 폴더에있을 필요는 없습니다. Spotlight 검색 결과 창에서 여러 항목을 선택할 수도 있습니다.

on run {input, parameters} 
    -- for every item having one of these extensions: 
    set ext_list to {"dng"} 
    -- also process items with same name but these extensions: 
    set other_ext_list to {"xmp"} 

    tell application "Finder" 
     set the_delete_list to {} 
     set delete_list to a reference to the_delete_list 
     -- populate list of items to delete 
     repeat with the_item in input 
      set the_item to (the_item as alias) 
      if name extension of the_item is in ext_list then 
       copy the_item to the end of delete_list 
       set parent_folder to (container of the_item) as alias as text 
       set item_name to text 1 thru ((length of (the_item's name as text)) - (length of (the_item's name extension as text))) of (the_item's name as text) 
       repeat with ext in other_ext_list 
        try 
         copy ((parent_folder & item_name & ext) as alias) to the end of delete_list 
        end try 
       end repeat 
      end if 
     end repeat 
     -- delete the items, show info dialog 
     move the_delete_list to the trash 
     display dialog "Moved " & (length of the_delete_list) & " files to the Trash." buttons {"OK"} 
    end tell 
end run 
+0

나는 dng 파일을 유지하면서 모든 nef/cr2 etc 파일을 제거하는 것을 제외하고는 비슷한 것을하기 위해 이것을 사용하려고합니다. 나는 스크립트를 살펴 봤지만, "delete_list의 끝에 복사 the_item"을 변경해야 할 유일한 줄은 무엇입니까? –

2

이 스크립트는 동일한 접두사를 공유하고 이름 확장명이 grep 명령에 나열된 모든 파일을 삭제합니다. 추가 확장 프로그램을 추가 할 수 있습니다. (xmp | DNG | pdf | xls)

+0

이름에 짧은 이름이 포함되어있는 것은 위험한 필터이며 너무 많은 파일이 삭제되는 높은 변경입니다. 위 코드를 사용하도록 제안하지 않으려 고합니다 –

+0

Dj가 더 좋습니까? – adayzdone

+0

나는 그것을 더 잘 수행하지 못했습니다. D (vote up) –