-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zsh] Move plagiarize to bin and make more robust
- Loading branch information
1 parent
64149d1
commit 85800fb
Showing
2 changed files
with
24 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/zsh | ||
|
||
# Copy one folder to another, renaming all files inside to match | ||
# Useful for weekly reports, where the folder and the files inside | ||
# (all the many latex files) include the date | ||
|
||
set -e | ||
|
||
src=$1 | ||
dst=$2 | ||
|
||
if [ -z $dst ]; then | ||
echo "No destination" | ||
return 1 | ||
fi | ||
if [ -e $dst ]; then | ||
echo "Destination already exists" | ||
return 1 | ||
fi | ||
cp -r $src $dst | ||
cd $dst | ||
# echo "rename $(basename $src) $(basename $dst) *" | ||
# rename $(basename $src) $(basename $dst) * | ||
rename "s/$(basename $src)/$(basename $dst)/" * |
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