Bỏ qua điều hướng
Dọn dẹp

Xếp thư mục Downloads theo loại file trên Mac

Workflow DockRun xếp các file nằm lẻ trong Downloads vào Images, Documents, Archives, Installers, Videos và Audio. Không xoá gì.

Nút này cần DockRun 0.1.19 trở lên. Với bản cũ hơn, bạn tải file về rồi vào Settings > Restore or Import… trong DockRun.

Chạy được trên DockRun Free (bản Free giữ được 2 workflow).

Nó làm gì

  • Chuyển từng file lẻ vào thư mục theo loại: Images, Documents, Archives, Installers, Videos hoặc Audio.
  • Thư mục con và loại file lạ thì để nguyên chỗ cũ.
  • Không bao giờ ghi đè: nếu đã có file trùng tên, file mới ở yên và được liệt kê ra.

Bạn chỉnh được gì

  • folder - The folder to sort. Mặc định: ~/Downloads

Các bước

Hãy đọc script bên dưới trước khi thêm. Đó là toàn bộ những gì workflow này chạy.

  1. 1. Sort the files
    Chạy script zsh này · Tham số: {{var.folder}} · Giới hạn thời gian: 60 giây
    # Sorts the loose files in a folder (default ~/Downloads) into Images, Documents, Archives, Installers,
    # Videos and Audio. Folders and unknown file types stay where they are; nothing is deleted or overwritten.
    folder="${*:-~/Downloads}"; folder="${folder/#\~/$HOME}"
    [ -d "$folder" ] || { echo "No such folder: $folder" >&2; exit 1 }
    typeset -A kinds
    kinds=(
      Images     "png jpg jpeg gif heic webp svg tiff bmp"
      Documents  "pdf doc docx xls xlsx ppt pptx txt md rtf csv pages numbers key epub"
      Archives   "zip rar 7z tar gz tgz bz2 xz"
      Installers "dmg pkg"
      Videos     "mp4 mov mkv avi webm m4v"
      Audio      "mp3 wav m4a flac aac ogg"
    )
    moved=0
    for file in "$folder"/*(N.); do
      ext="${(L)file:e}"; [ -n "$ext" ] || continue
      for kind in ${(k)kinds}; do
        if [[ " ${kinds[$kind]} " == *" $ext "* ]]; then
          mkdir -p "$folder/$kind"
          if [ -e "$folder/$kind/${file:t}" ]; then echo "Kept ${file:t} (a file with that name is already in $kind)"
          else mv -n "$file" "$folder/$kind/" && moved=$((moved + 1)); fi
          break
        fi
      done
    done
    echo "Sorted $moved files in $folder"
    

Sau khi thêm

  1. DockRun cho bạn xem trong file có gì và hỏi trước khi thêm. Workflow được thêm ở trạng thái tắt.
  2. Mở workflow, đọc các bước, rồi bật công tắc On.
  3. Bấm Run. DockRun hỏi trước khi chạy script; khi đã tin thì tích "Don't ask again for this exact step".

Nên biết

Dùng được cho mọi thư mục: đổi biến folder để xếp Desktop chẳng hạn.

Thử lần cuối: 2026-11-12 · Tất cả workflow →

Bạn đang tò mò DockRun có hợp với mình không?

Cứ để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp - bấm vào bên dưới xem AI thực sự nghĩ gì về DockRun.

Xếp thư mục Downloads theo loại file trên Mac | DockRun