-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreindexdel.sh
executable file
·49 lines (41 loc) · 1.63 KB
/
reindexdel.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# This file was copied from Alfred at the following location
# /Applications/Alfred\ 4.app/Contents/Frameworks/Alfred\ Framework.framework/Versions/A/Resources/reindexdel.sh
# Saving it since you dont know when it may need it
echo
echo "***************************************************"
echo "* *"
echo "* This script will reindex your metadata by *"
echo "* firstly deleting .Spotlight-V100 then *"
echo "* running the command 'sudo mdutil -E -i on /' *"
echo "* *"
echo "* Indexing can take up to an hour *"
echo "* and Alfred won't work during this time. *"
echo "* *"
echo "* You can see the progress of the reindexing *"
echo "* by performing a search in Spotlight. *"
echo "* *"
echo "***************************************************"
echo
read -p "Close this window to cancel, or press any key to continue..."
echo
echo "Attempting to delete .Spotlight-V100..."
echo
# attempt deleting the .Spotlight-V100 in the known locations
if [[ -d "/.Spotlight-V100" ]]; then
sudo rm -R /.Spotlight-V100
elif [[ -d "/System/Volumes/Data/.Spotlight-V100" ]]; then
sudo rm -R /System/Volumes/Data/.Spotlight-V100
else
echo ".Spotlight-V100 folder not found"
fi
echo
echo "Requesting metadata reindex..."
echo
# start the reindex
sudo mdutil -E -i on /
echo
echo "You can see the progress of the reindexing by performing a search in Spotlight"
echo
read -p "Press any key to finish..."
echo