Skip to content

Instantly share code, notes, and snippets.

@yuchenlin
Last active April 22, 2021 02:13
Show Gist options
  • Save yuchenlin/08134f5779b34dade090d9e33a2e9d4b to your computer and use it in GitHub Desktop.
Save yuchenlin/08134f5779b34dade090d9e33a2e9d4b to your computer and use it in GitHub Desktop.
`mv` a folder with a progress bar and detailed logs.
#!/bin/bash
# Usage: bash mv.sh /path/to/src/ /path/to/target/
sourcedir=$1
targetdir=$2
filecount=$(find $sourcedir | wc -l)
echo $filecount # Print the number of the total files.
mkdir $targetdir
mv -v $sourcedir $targetdir | pv -l -s $filecount > /tmp/mv_log.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment