-
Notifications
You must be signed in to change notification settings - Fork 3
/
mv-note.sh
30 lines (21 loc) · 926 Bytes
/
mv-note.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Example:
# sh mv-note.sh ./download-google-images/downloads/fake-vault ./download-google-images/downloads/*.md
destPath="$1"
shift
for var in "$@"
do
srcPath="$(dirname "${var}")"
filename="$(basename "${var}")"
filenameWithoutExtension="${filename%.md}"
#echo srcPath is "$srcPath"
#echo filenameWithoutExtension is "$filenameWithoutExtension"
if [ -d "$srcPath/assets/$filenameWithoutExtension" ]
then
echo python change-note-name-asset-dir-name-and-assets-links.py "$srcPath" -f -o "$filenameWithoutExtension" -n "$filenameWithoutExtension" -p "$destPath"
python change-note-name-asset-dir-name-and-assets-links.py "$srcPath" -f -o "$filenameWithoutExtension" -n "$filenameWithoutExtension" -p "$destPath"
mkdir -p "$destPath/assets/"
mv "$srcPath/assets/$filenameWithoutExtension" "$destPath/assets/"
fi
mv "$var" "$destPath"
done