1

I'm trying to move files (movies) between directories. I have a script which renames my movies and then a separate script which I use to open a new terminal and monitor the movies being moved from one directory to another using progress.

This works fine, but I'd like to use pv instead and run everything from the same terminal. Thing is, my unix command skills are limited at best.

Can someone please identify how I would add a pv call in the following script?

#!/bin/bash

lxterminal -e watch progress -w

for file in /home/temp/*.mp4
  do
    mv /home/temp/*.mp4 /home/Movies/
  done
Paulo Tomé
  • 3,754
  • 6
  • 26
  • 38
jb.
  • 11
  • 2
  • `pv` is meant to be a pipeline stage and reports the data that goes through it. When you use `mv` there is very little data movement involved (as long as files are moved withing the same file system, but this seems to be the case here). Having the file data go through `pv` would result is a lot of unnecessary I/O that would tremendously slow the process down . Did you try to just use `mv -v`? – xenoid Jan 03 '20 at 22:52
  • there was a similar question (regarding `pv` and `md5sum`, but some of it may work the same for `mv`): https://unix.stackexchange.com/q/495477/30851 – frostschutz Jan 03 '20 at 23:05
  • 1
    No, I've not tried ```mv -v```. I will take a look. No, the files are on different servers - one is mounted locally; this is where the bottleneck is that I wished to monitor. Thanks – jb. Jan 03 '20 at 23:37
  • I would suggest that you do not move, but copy with **`rsync`**. After copying you should confirm that the copying was successful, and when you are sure that it was successful you can remove the files from the original location. 'rsync` is a very powerful tool, and you can monitor the progress with options in the tool itself, there is no need for `pv` in this case. – sudodus Jan 04 '20 at 09:59

0 Answers0