透過 autosys 刪除 unix shell 腳本中早於 X 天的文件,不包括子目錄和計劃

透過 autosys 刪除 unix shell 腳本中早於 X 天的文件,不包括子目錄和計劃

我正在使用下面的腳本從資料夾中刪除文件

script.sh文件僅包含這一行:

find /usr/filesfolder -type f -iname '*' -mindepth 1 -mtime +1825 -exec rm {} \

Autosys 作業總是會失敗並顯示下列錯誤輸出:

/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: 
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:

答案1

find 的選項-exec必須以分號終止(並從 shell 中轉義),例如-exec rm {} \;

相關內容