Last active
April 22, 2021 02:13
-
-
Save yuchenlin/08134f5779b34dade090d9e33a2e9d4b to your computer and use it in GitHub Desktop.
`mv` a folder with a progress bar and detailed logs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
The command will show a progress bar and ETA for the overall movement. You can check
/tmp/mv_log.txt
for a detailed list of moved files.