検索コマンド - スペースを含むファイルパス

検索コマンド - スペースを含むファイルパス

複数の異なるフォルダを介して実行し、ファイル名に「16x9」を含むIndesignファイルを見つけて、小さなAppleScriptコードを介して繰り返すスクリプトを使用しようとしています。問題が発生しました。結果は次のとおりです。

The file /Users/admin/Documents/00_Primary/Cordish/Cordish does not exist.

私はファイルパス全体のスペースを考慮せずに何が起こっていると仮定します。フルファイルパスは次のとおりです。

/Users/admin/Documents/00_Primary/Cordish/Cordish Horizontal/CordishAtlanta_Horizontal-16x9.indd

これが私が今まで持っているものです:

#!/bin/bash

FILES=find /Users/admin/Documents/00_Primary -name "*16x9.indd" -print0
for f in `$FILES`; do

    open -a "Adobe InDesign CC 2018" "$f"
    osascript <<'EOF'
tell application "System Events" to tell process "Adobe InDesign CC 2018"
    set frontmost to true
    delay 5
    tell application "System Events"
        key code 15 using {option down}
        delay 2
        key code 15 using {control down}
        delay 2
        key code 48
        delay .3
        key code 125
        delay .3
        key code 48
        delay .3
        key code 25
        delay .3
        key code 36
        delay 1
        key code 36
        delay .3
        key code 1 using {command down}
        key code 2
        delay .5
        key code 36
        delay 1
        key code 13 using {command down}
    end tell
end tell

EOF


done

ベストアンサー1

何が必要です:

次にファイル処理を実行しますscript.sh

find /Users/admin/Documents/00_Primary -name "*16x9.indd" -exec ./script.sh {} \;

おすすめ記事