0

in my bash script I wrote this

echo "move file - $file to $folder  Start"
mv $file $folder
echo "move file - $file to $folder  Ended"
  • file is under file system - "/"
  • folder is under file system - "/var"

so the script print like this

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

but I want to print the output , like this ( with "." that will printed each 5 sec as progress bar )

move file - file.txt to archive  start........end
move file - repo.txt to archive  start.....end
move file - list.txt to archive  start.............................end
5
  • Are source and target on the same or on different file systems (e.g. use df to find out)? If same, the rename runs very quickly (microseconds at most). Aug 28, 2017 at 9:29
  • they are on diff file system one is "/" and folder is "/var"
    – yael
    Aug 28, 2017 at 9:38
  • Please edit your question but don't comment it. Aug 28, 2017 at 9:47
  • Maybe you want to use pv Aug 28, 2017 at 9:50
  • done - see my update please
    – yael
    Aug 28, 2017 at 9:57

1 Answer 1

1

You can use rsync instead.

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

--remove-source-files sender removes synchronized files (non-dirs)

-P progress

Output will something like this:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .