Skip to content

Commit 85800fb

Browse files
[zsh] Move plagiarize to bin and make more robust
1 parent 64149d1 commit 85800fb

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

bin/plagiarize

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/zsh
2+
3+
# Copy one folder to another, renaming all files inside to match
4+
# Useful for weekly reports, where the folder and the files inside
5+
# (all the many latex files) include the date
6+
7+
set -e
8+
9+
src=$1
10+
dst=$2
11+
12+
if [ -z $dst ]; then
13+
echo "No destination"
14+
return 1
15+
fi
16+
if [ -e $dst ]; then
17+
echo "Destination already exists"
18+
return 1
19+
fi
20+
cp -r $src $dst
21+
cd $dst
22+
# echo "rename $(basename $src) $(basename $dst) *"
23+
# rename $(basename $src) $(basename $dst) *
24+
rename "s/$(basename $src)/$(basename $dst)/" *

zsh/custom/functions.zsh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,6 @@ function yay() {
9494
command yay "$@"
9595
}
9696

97-
# Copy one folder to another, renaming all files inside to match
98-
# Useful for weekly reports, where the folder and the files inside
99-
# (all the many latex files) include the date
100-
function plagiarise() {
101-
102-
src=$(basename $1)
103-
dst=$(basename $2)
104-
105-
if [ -z $dst ]; then
106-
echo "No destination"
107-
return 1
108-
fi
109-
if [ -e $dst ]; then
110-
echo "Destination already exists"
111-
return 1
112-
fi
113-
cp -r $src $dst
114-
cd $dst
115-
rename $src $dst *
116-
}
11797
function poster() {
11898
ffmpeg -i $1 -r 1 -f image2 $2
11999
}

0 commit comments

Comments
 (0)