ファイルとフォルダの詳細を含むフォルダにファイルを移動したときの進行状況バーの印刷

ファイルとフォルダの詳細を含むフォルダにファイルを移動したときの進行状況バーの印刷

私のbashスクリプトで私はこれを書いた

echo "move file - $file to $folder  Start"
mv $file $folder
echo "move file - $file to $folder  Ended"
  • ファイルはファイルシステム( "/")の下にあります。
  • フォルダはファイルシステム「/var」の下にあります。

したがって、スクリプトは次のように印刷されます。

move file - file.txt to archive  Start
move file - file.txt to archive  Ended

しかし、次のように出力を印刷したいです(5秒ごとに進行状況バーを印刷するには「.」を使用)。

move file - file.txt to archive  start........end
move file - repo.txt to archive  start.....end
move file - list.txt to archive  start.............................end

ベストアンサー1

代わりにrsyncを使用できます。

rsync --remove-source-files -P /src_folder/src_file /dst_folder/dst_file

--remove-source-files 送信者が同期されたファイル(ディレクトリを除く)を削除します。

-P 進展

出力は次のとおりです。

316,628,992 100%  132.31MB/s    0:00:02 (xfr#1, to-chk=0/1)

おすすめ記事