
我想將檔案從一個資料夾移動到另一個資料夾,當檔案名稱不包含空格時,我的程式碼工作正常,但如果檔案名稱中有空格,則會出現錯誤我的程式碼如下:
find [folderName] -size +1k -type f -name \*.txt -print0 | while IFS= read -r -d '' file; do
echo $file
mv $file targetfolderName
done
檔案名稱
範例 01.txt 測試 - 複製 01.txt
答案1
嘗試這個
find [folderName] -size +1k -type f -name \*.txt -print0 | while IFS= read -r -d '' file; do
echo $file
mv "$file" targetfolderName
done