透過目錄移動檔案的熱鍵 (MacOS)

透過目錄移動檔案的熱鍵 (MacOS)

MacOS 中是否有熱鍵可以在父資料夾和子資料夾之間上下移動資料夾?

例如,在這個簡單的範例中,我想將檔案 1234.pdf 移至資料夾 A,這將使子資料夾 A 為空。理想情況下,我只需使用鍵盤即可完成此操作。加分點:用於重新選擇上次選擇的子資料夾的熱鍵(以便我可以刪除、重新命名等)。

- Folder A
   - Subfolder A
      -File 1234.pdf 
- Folder B

答案1

對於未能及時回覆您的答复,我深表歉意。這比我預想的更具挑戰性。

但可以透過創造一個來實現你想要的服務自動機,然後可以透過鍵盤快捷鍵(熱鍵)進行存取。

你需要遵循本指南提供全系統服務


首先建立一個新服務自動機。它將需要接收文件或資料夾作為輸入,並可在發現者

添加一個運行AppleScript對工作流程採取的行動。在該操作的文字區域中,可以複製並貼上以下 AppleScript:

    use Finder : application "Finder"

    property F_ : missing value -- The previous folder
    property f : missing value -- The files that we moved
    property home : Finder's home as alias


    on run {f, _}
      get its ParentFolderOf:(some item in f)
      set there to the result -- The destination folder, one level up

      -- We won't navigate any higher up the folder tree than
      -- the home folder
      if (its ParentFolderOf:home) is in there then return

      -- Also don't apply this service to other folders that aren't
      -- in the same branch of the folder tree as the home folder
      if (there as text) does not begin with (home as text) then return

      -- The folder we're currently at
      tell Finder to set F_ to ¬
        (the container of some item in f) as alias

      -- Check to ensure there are no files in the destination folder
      -- that risk being overwritten.  If there are, we won't move
      -- the files who share the same name, i.e. only move those that 
      -- are safe to move.
      tell Finder to ¬
        repeat with _g in f
          get name of _g
          set g to [there as text, result] as text
          if not (g exists) then set end of f to _g
          set f to the rest of f
        end repeat

      -- Move the files
      tell Finder ¬
        to set f ¬
        to (move f to there) ¬
        as list as alias list

      -- Reveal them
      reveal f
      activate Finder
    end run


    to ParentFolderOf:(f as alias)
      local f

      set F_ to [f, "::"] as text as alias

      if (f as text) ends with ":" then return F_

      return its ParentFolderOf:F_
    end ParentFolderOf:

將服務儲存為您喜歡的任何內容。 自動機自動將其保存在正確的位置(〜/圖書館/服務)。我把我的保存為“在 Finder 中上升”

接下來,您必須建立鍵盤快捷鍵。這是透過系統偏好設定:

鍵盤快速鍵

在服務清單下,您需要向下捲動到標記的部分文件和資料夾,其下應顯示您的服務名稱。你可以看到我的突出顯示。我為我的創建了快捷方式Ctrl+向上鍵)。

現在,每次我選擇文件和/或資料夾時發現者然後按,這些檔案和資料夾將在層次結構中上升一級,進入其父資料夾。如果我想將它們移回來,我可以按Z撤消該移動。

我設定了保護措施,以便文件和資料夾不會在資料夾樹中移動到比主資料夾更高的位置。無論如何,你不太可能需要這樣做。

答案2

如果您在列視圖中工作,則只需使用箭頭鍵即可導覽。

對於您的範例,假設您從選擇的文件開始...

  • Cmd ⌘ C 複製

  • 向左箭頭 [這將選擇子資料夾 A],因此對於獎勵積分...

    • Enter ⌅ 將允許您重命名它,或 Cmd ⌘ Backspace ⌫ 刪除它
      [這不會丟失當前複製緩衝區中的檔案]
  • 向左箭頭 [這將選擇資料夾 A]*

  • Cmd ⌘ Opt ⌥ V 移動

這是一開始出現的結構。

在此輸入影像描述

並在最後再次[在我們過去刪除子資料夾 A 之後]

在此輸入影像描述

*因為答案中沒有提到它,此時向下箭頭將選擇資料夾 B

相關內容