2
我已經創建了以下腳本,用於將舊日文件從源目錄定義到目標目錄。它工作完美。bash腳本改進
#!/bin/bash
echo "Enter Your Source Directory"
read soure
echo "Enter Your Destination Directory"
read destination
echo "Enter Days"
read days
find "$soure" -type f -mtime "-$days" -exec mv {} "$destination" \;
echo "Files which were $days Days old moved from $soure to $destination"
該腳本移動文件很大,但它也移動源子目錄的文件,我不想。 它不應該採取子目錄文件。我怎樣才能做到這一點 ?
,它應該補充? –
我的查找命令應該找到-maxdepth 1「$ soure」-type f -mtime「 - $ days」-exec mv {}「$ destination」\; 什麼? –
not working給出以下錯誤find:warning:在非選項參數-type後指定了-maxdepth選項,但選項不是位置的(-maxdepth會影響在它之前指定的測試以及在它之後指定的測試)。請在其他參數前指定選項。 –