pv /path/to/file > /path/to/copied/file For a little more complexity, you can make a function out of it, and place it in ~/.bashrc to be sourced automatically:
progcp() {
if [ -d "$1" ]; then
echo "Input is a directory. Exiting."
return
fi
if [ -d "$2" ]; then
OUTFILE="$2/"`basename "$1"`
else
OUTFILE="$2"
fi
pv "$1" > "$OUTFILE"
}
I'm interested to know how to add normal command-line switches to a Bash function, so you could add flags like -r (recursive), or some of pv's switches, but this function works well for a single file local copy, such as a movie or an iso. Just call it like this:
progcp /path/to/file /path/to/output/file/or/directory
No comments:
Post a Comment