ディレクトリ間でファイルを移動するためのホットキー (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:

好きなようにサービスを保存します。 オートメーター自動的に適切な場所に保存されます(~/ライブラリ/サービス)。私は次のように保存しました「ファインダーで昇る」

次に、キーボードショートカットを作成する必要があります。これは、システム環境設定:

キーボードショートカット

サービスリストの下で、マークされたセクションまでスクロールする必要がありますファイルとフォルダの下にサービス名が表示されます。私のサービス名がハイライト表示されているのがわかります。私は自分のサービス用のショートカットを作成しましたCtrl+上)。

今では、ファイルやフォルダを選択するたびにファインダを押して、 を押すと、それらのファイルとフォルダは階層を 1 つ上の親フォルダに移動します。元に戻したい場合は、 を押してZ移動を取り消すことができます。

ファイルとフォルダがホーム フォルダより上位のフォルダ ツリーに移動されないように保護策を講じました。いずれにしても、その必要はまずないでしょう。

答え2

列ビューで作業する場合は、矢印キーだけで移動できます。

たとえば、ファイルを選択した状態で開始するとします...

  • Cmd ⌘ C コピーする

  • 左矢印 [サブフォルダー A が選択されます] で、ボーナスポイントを獲得できます...

    • Enter ⌅ Cmd ⌘ Backspace ⌫ 名前を変更したり、削除したりすることができます
      [これにより、コピー バッファ内のファイルが失われることはありません]
  • 左矢印[フォルダAを選択します]*

  • Cmd ⌘ Opt ⌥ V 移動する

これは冒頭に出てくる構造です。

ここに画像の説明を入力してください

そして最後にもう一度[途中でサブフォルダAを削除した後]

ここに画像の説明を入力してください

*回答のどこにも記載されていないため、この時点で下矢印はフォルダBを選択します。

関連情報