-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsstool
55 lines (40 loc) · 1.26 KB
/
sstool
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#Since changing default screenshot directory in macOS need to modify system preference and
#often should be done with caution, it is better to just move all previous screenshots to one folder,
#manipulate the current screenshots after that, and move all previous screenshots back to desktop.
checkSS=$(ls ~/desktop | egrep "^Screenshot*")
newSet(){
if [ "$checkSS" != "" ]; then
mv ~/desktop/Screen* ~/desktop/tempHolder_ss
mkdir ~/desktop/tempHolder_ss
fi
}
rename(){
mkdir ~/desktop/ss_set
filenum=$(ls ~/desktop | egrep -i "^Screenshot" | wc -l)
for((i=0; i<$filenum; i++));do
file=$(ls ~/desktop | egrep -m 1 "^Screenshot")
mv ~/desktop/"$file" ~/desktop/ss_set/img$i.png
done
if [ "$checkSS" != "" ]; then
mv ~/desktop/tempHolder_ss/Screen* ~/desktop
rmdir ~/desktop/tempHolder_ss
fi
}
dropin(){
mv ~/desktop/ss_set ./"$1"
}
if [ "$1" == "-newset" ]; then
newSet
echo "New Set Ready"
elif [ "$1" == "-rename" ]; then
rename
echo "Screenshots Renamed. Files in ~/desktop/ss_set"
elif [ "$1" == "-dropin" ]; then
dropin "$2"
finalName="ss_set"
if [ "$2" != "" ]; then
finalName="$2"
fi
echo "Your screenshots are now in the current directory as $finalName"
fi