Skip to content

Commit e036aba

Browse files
authored
Update aliases and rsync options in .zshrc
1 parent 5dee72d commit e036aba

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.zshrc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ killn()( ps -ef | grep "$*" | grep -v "grep.*$*" | awk '{print $2}' | xargs -r k
379379
skilln()( ps -ef | grep "$*" | grep -v "grep.*$*" | awk '{print $2}' | sudo xargs -r kill -9 )
380380

381381
### files
382-
alias rcp="rsync -aP -h"
383-
rmv()( if [ "$#" -ne 2 ]; then echo -e "Usage:\nrmv A B (move A into B -> B/A)\nrmv A/ B (move the content of A into B, like mv A B)"; return 1; fi; rsync -aP -h --remove-source-files "$1" "$2" && rm -r "$1" )
384-
rrm()( if [ -f "$1" ] || [ -h "$1" ]; then rm "$1"; elif [ -d "$1" ]; then local temp_dir=$(mktemp -d); rsync -aP --delete "$temp_dir/" "$1"; rm -rf "$temp_dir" "$1"; else echo "$1 is not a valid file, directory, or symlink"; return 1; fi )
385-
srrm()( if [ -f "$1" ] || [ -h "$1" ]; then sudo rm "$1"; elif [ -d "$1" ]; then local temp_dir=$(mktemp -d); sudo rsync -aP --delete "$temp_dir/" "$1"; sudo rm -rf "$temp_dir" "$1"; else echo "$1 is not a valid file, directory, or symlink"; return 1; fi )
382+
alias rcp="rsync -a --partial --info=progress2 -h"
383+
rmv()( if [ "$#" -ne 2 ]; then echo -e "Usage:\nrmv A B (move A into B -> B/A)\nrmv A/ B (move the content of A into B, like mv A B)"; return 1; fi; rsync -a --info=progress2 -h --remove-source-files "$1" "$2" && rm -r "$1" )
384+
rrm()( if [ -f "$1" ] || [ -h "$1" ]; then rm "$1"; elif [ -d "$1" ]; then local temp_dir=$(mktemp -d); rsync -a --delete "$temp_dir/" "$1"; rm -rf "$temp_dir" "$1"; else echo "$1 is not a valid file, directory, or symlink"; return 1; fi )
385+
srrm()( if [ -f "$1" ] || [ -h "$1" ]; then sudo rm "$1"; elif [ -d "$1" ]; then local temp_dir=$(mktemp -d); sudo rsync -a --delete "$temp_dir/" "$1"; sudo rm -rf "$temp_dir" "$1"; else echo "$1 is not a valid file, directory, or symlink"; return 1; fi )
386386
trash()( # compatible with rm
387387
allowed_args="-f|-h|--help|--trash-dir|-v|--verbose|--version"
388388
new_args=""
@@ -424,9 +424,9 @@ spwd()(
424424
spwd_=$user_host:$pwd_
425425
link=$(realpath $pwd_)
426426
echo "[ SCP ] scp -P $port -r \"$spwd_\" ./"
427-
echo "[ SRCP ] rsync -aP -h -e \"ssh -p $port\" \"$spwd_\" ./"
427+
echo "[ SRCP ] rsync -a --partial --info=progress2 -h -e \"ssh -p $port\" \"$spwd_\" ./"
428428
echo "[ STCP ] ssh -p $port $user_host 'tar -cf - -C \"$(dirname $pwd_)\" \"$(basename $pwd_)\"' | tar -xvf - -C ."
429-
echo "[ RCP ] rsync -aP -h \"$pwd_\" ./"
429+
echo "[ RCP ] rsync -a --partial --info=progress2 -h \"$pwd_\" ./"
430430
echo "[ TCP ] tar -cf - -C \"$(dirname $pwd_)\" \"$(basename $pwd_)\" | tar -xvf - -C ."
431431
echo "[ SPWD ] $spwd_"
432432
echo "[ PORT ] $port"
@@ -562,7 +562,7 @@ update_workspace()(
562562
mv $WS/.Make-Workspace_tmp/.p10k.zsh $HOME/.p10k.zsh
563563
mv $WS/.Make-Workspace_tmp/my_configs.vim $HOME/.vim_runtime/my_configs.vim
564564
mv $WS/.Make-Workspace_tmp/.tmux.conf $HOME/.tmux.conf
565-
rsync -av $WS/.Make-Workspace_tmp/.ws/ $WS/
565+
rsync -a $WS/.Make-Workspace_tmp/.ws/ $WS/
566566
rm -rf $WS/.Make-Workspace_tmp
567567

568568
tmux source-file $HOME/.tmux.conf

0 commit comments

Comments
 (0)