이것은 사용자가 2025-5-7 17:14에 https://interfacecraft.online/posts/blog/2025/how-i-automated-my-computer-life-with-macos-folder-act...을(를) 위해 저장한 이중 언어 스냅샷 페이지로, 몰입형 번역에 의해 제공된 이중 언어 지원이 있습니다. 저장하는 방법을 알아보세요?

How I Automated My Computer Routine With macOS Folder Actions
macOS 폴더 동작으로 내 컴퓨터 작업을 자동화한 방법

February 12, 2025  2025년 2월 12일

I’ve always believed that computers should handle repetitive tasks better than humans. It frustrates me when something can’t be automated the way I want or when simple actions require more effort than they should.
저는 컴퓨터가 반복 작업을 인간보다 더 잘 처리해야 한다고 항상 믿어왔습니다. 원하는 방식으로 자동화할 수 없거나 간단한 작업에 너무 많은 노력이 필요할 때 답답함을 느낍니다.

Let’s say we want to convert a video from one format to another. This often happens to me when I need to share a screencast video with colleagues on Slack. By default, macOS records in .MOV format, which is too large to share. Sometimes, I also have another file that I want to shrink for easier sharing in a message.
예를 들어, 비디오를 한 형식에서 다른 형식으로 변환하고 싶다고 가정해봅시다. 이는 동료들과 슬랙에서 화면 녹화 비디오를 공유해야 할 때 자주 발생합니다. 기본적으로 macOS는 .MOV 형식으로 녹화하는데, 이 형식은 공유하기에 너무 용량이 큽니다. 때로는 메시지로 더 쉽게 공유하기 위해 다른 파일을 용량 줄이고 싶을 때도 있습니다.

Previously, I used a macOS GUI app to convert in .MP4, and the steps from start to finish were:
이전에는 macOS GUI 앱을 사용하여 .MP4로 변환했으며, 시작부터 끝까지의 단계는 다음과 같았습니다:

Such a simple need, yet so many manual actions were required.
이렇게 간단한 필요성인데도 불구하고 너무 많은 수동 작업이 필요했습니다.

So I realized that I could use the powerful macOS Folder Actions . I decided to use them as a trigger for my needs—any need. Drop the file in, and the folder action trigger does the job.
그래서 강력한 macOS 폴더 액션을 사용할 수 있다는 것을 깨달았습니다. 저는 이를 제 필요에 맞는 트리거로 사용하기로 결정했습니다—어떤 필요든지요. 파일을 드롭하면 폴더 액션 트리거가 작업을 수행합니다.

Here’s a quick demo of how much easier converting .MOV files into .MP4 has become with drag and drop. Drop a file, wait, and it’s done. It’s pure magic!
.MOV 파일을 .MP4로 변환하는 작업이 드래그 앤 드롭으로 얼마나 쉬워졌는지 빠른 데모를 보여드리겠습니다. 파일을 드롭하고 기다리면 끝입니다. 완전 마법 같아요!

And original file deleted automatically as well.
그리고 원본 파일도 자동으로 삭제됩니다.

List of My Folder Actions
나의 폴더 액션 목록

After some time, I created folder actions for various tasks.
어느 정도 시간이 지나고 나서, 다양한 작업을 위한 폴더 액션을 만들었습니다.

Need to convert .JPG to .WEBP? I have a folder for that.
.JPG를 .WEBP로 변환해야 하나요? 그걸 위한 폴더가 있습니다.

Need to download a Twitter video? I have a folder for that.
트위터 동영상을 다운로드해야 하나요? 그걸 위한 폴더가 있습니다.

And it’s pretty easy to set up too.
그리고 설정도 꽤 쉽습니다.

How to Set Up macOS Folder Actions
macOS 폴더 작업 설정 방법

Please note that once you set up Folder Actions, you can’t change the folder name without breaking the folder actions. If you rename the folder, you must reattach the folder actions again.
폴더 작업을 설정한 후에는 폴더 이름을 변경하면 폴더 작업이 작동하지 않으니 주의하세요. 폴더 이름을 변경하면 폴더 작업을 다시 연결해야 합니다.

Steps:  단계:

  1. In Terminal:  터미널에서:
brew install ffmpeg
  1. Create and name a folder.
    폴더를 만들고 이름을 지정합니다.
  2. Open Automator and create a new Folder Action project.
    Automator를 열고 새 폴더 작업 프로젝트를 만듭니다.
  3. Add Get Selected Finder Items and Run Shell Script. Change Pass input to “as arguments”. Select the folder.
    선택한 Finder 항목 가져오기와 셸 스크립트 실행을 추가합니다. 입력 전달 방식을 "인수로"로 변경합니다. 폴더를 선택합니다.
  4. To convert .MOV to .MP4, enter the following shell script (in all privided scripts you need to change file output path to yours):
    .MOV를 .MP4로 변환하려면 다음 셸 스크립트를 입력하세요(제공된 모든 스크립트에서 파일 출력 경로를 자신의 경로로 변경해야 합니다):
for f in "$@"; do
    /opt/homebrew/bin/ffmpeg -n -loglevel error -i "$f" -vcodec libx264 -crf 23 -preset ultrafast -tune film "/Users/alexander/Library/Mobile\ Documents/com\~apple\~CloudDocs/Downloads/$(date +"%Y_%m_%d_%I_%M_%p_%s").mp4";
    rm -f "$f"
done
  1. Save and exit.  저장하고 종료합니다.
  2. Drag and drop a .MOV file into the folder. If it works, you should see gear icon in the menu bar. When it goes away - it means script is finished the task.
    .MOV 파일을 폴더로 드래그 앤 드롭하세요. 작동하면 메뉴 바에 기어 아이콘이 표시됩니다. 아이콘이 사라지면 스크립트 작업이 완료된 것입니다.

Additional Folder Actions
추가 폴더 작업

Convert Video to GIF  비디오를 GIF로 변환하기

for f in "$@"; do
    /opt/homebrew/bin/ffmpeg -n -loglevel error -i "$f" -vf "fps=18,scale=720:-1:flags=lanczos" "/Users/alexander/Library/Mobile Documents/com~apple~CloudDocs/Downloads/$(date +"%Y_%m_%d_%I_%M_%p_%s").gif";
    rm -f "$f"
done

Convert Image to WEBP:
이미지를 WEBP로 변환:

for f in "$@"; do
    /opt/homebrew/bin/cwebp -q 70 "$f" -o "/Users/alexander/Library/Mobile Documents/com~apple~CloudDocs/Downloads/$(date +"%Y_%m_%d_%I_%M_%p_%s").webp";
    rm -f "$f"
done

Download YouTube Videos:
유튜브 동영상 다운로드:

  1. In Terminal:  터미널에서:
brew install yt-dlp
  1. Use this script:  이 스크립트를 사용하세요:
# Process each .webloc file
for f in "$@"; do
    echo "Processing file: $f"
    
    # Extract URL between <string> tags
    url=$(grep -o '<string>.*</string>' "$f" | sed 's/<string>\(.*\)<\/string>/\1/')
    echo "Extracted URL: $url"
    
    # Check if URL was found
    if [ -n "$url" ]; then
        echo "Attempting to download from: $url"
        
        # Download video using yt-dlp to the Downloads folder
        /opt/homebrew/bin/yt-dlp -P "~/Downloads" "$url"
        
        # Check if the download was successful
        if [ $? -eq 0 ]; then
            echo "Download successful, removing webloc file"
            rm -f "$f"
        else
            echo "Download failed"
        fi
    else
        echo "Error: No URL found in '$f'"
    fi

done

  1. Drop a website URL directly into the folder.
    웹사이트 URL을 폴더에 직접 드롭하세요.

Download Twitter Videos:  트위터 비디오 다운로드:

#!/bin/bash

# Process each .webloc file
for f in "$@"; do
    echo "Processing file: $f"
    
    # Extract URL between <string> tags
    url=$(grep -o '<string>.*</string>' "$f" | sed 's/<string>\(.*\)<\/string>/\1/')
    echo "Extracted URL: $url"
    
    # Check if URL was found
    if [ -n "$url" ]; then
        echo "Attempting to download from: $url"
        
        # Download video using yt-dlp to the Downloads folder
        /opt/homebrew/bin/yt-dlp -P "~/Downloads" "$url"
        
        # Check if the download was successful
        if [ $? -eq 0 ]; then
            echo "Download successful, removing webloc file"
            rm -f "$f"
        else
            echo "Download failed"
        fi
    else
        echo "Error: No URL found in '$f'"
    fi

done

Convert YouTube Videos to MP3 File Directly:
유튜브 비디오를 MP3 파일로 직접 변환:

  1. In Terminal:  터미널에서:
brew install yt-dlp; brew install ffmpeg
  1. Use this script:  이 스크립트를 사용하세요:
# Process each .webloc file
for f in "$@"; do
    echo "Processing file: $f"
    
    # Extract URL between <string> tags
    url=$(grep -o '<string>.*</string>' "$f" | sed 's/<string>\(.*\)<\/string>/\1/')
    echo "Extracted URL: $url"
    
    # Check if URL was found
    if [ -n "$url" ]; then
        echo "Attempting to download from: $url"
        
        # Download video using yt-dlp to the Downloads folder
        /opt/homebrew/bin/yt-dlp -x --audio-format mp3 --audio-quality 0 --ffmpeg-location /opt/homebrew/bin/ffmpeg -P "~/Downloads" "$url"
        
        # Check if the download was successful
        if [ $? -eq 0 ]; then
            echo "Download successful, removing webloc file"
            rm -f "$f"
        else
            echo "Download failed"
        fi
    else
        echo "Error: No URL found in '$f'"
    fi

done
  1. Drop a website URL directly into the folder.
    웹사이트 URL을 폴더에 직접 드롭하세요.

Folder Actions Tweaking  폴더 작업 조정

If you need to change a folder action, right-click on the folder and select Folder Action Setup.
폴더 작업을 변경해야 하는 경우, 폴더를 마우스 오른쪽 버튼으로 클릭하고 폴더 작업 설정을 선택하세요.

All saved actions are stored in:
모든 저장된 작업은 다음 위치에 저장됩니다:

Macintosh HD / Users / YourName / Library / Workflows / Applications / Folder Actions/

It’s become so powerful that I’m willing to extend this system to even more actions. Because now you can turn a folder to an interface for any conmmand line app. So now my desktop is more useful than ever:
이 시스템이 너무 강력해져서 더 많은 작업으로 확장할 의향이 있습니다. 이제 폴더를 모든 명령줄 앱의 인터페이스로 바꿀 수 있기 때문입니다. 그래서 이제 내 데스크탑은 그 어느 때보다 더 유용해졌습니다: