forked from JayRizzo/Random_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean_mac.sh
102 lines (84 loc) · 4.16 KB
/
clean_mac.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
# =============================================================================
# MAC OSX HIGH SIERRA 10.13.4 (17E199)
# Terminal: Version: 2.8.2 64-Bit (Intel): Yes
# Terminal Location: /Applications/Utilities/Terminal.app
# =============================================================================
# Terminal CLEAN UP YOUR DOCUMENTS FOLDER.
# =============================================================================
# START WHAT IS BELIEVED TO BE EMPTY NOW.
# =============================================================================
echo 'Searching Documents for empty folders...'
find ~/Documents -type d -empty;
# =============================================================================
# SHOW & THEN REMOVE ALL MAC OS DS_Store FILES
# =============================================================================
echo 'Searching Documents for DS_Store files...'
find ~/Documents -type f -name ".DS_Store" -print;
echo 'Removing DS_Store files...'
find ~/Documents -type f -name ".DS_Store" -print -delete;
# =============================================================================
# SHOW & THEN REMOVE ALL MAC OS pyc FILES
# =============================================================================
echo 'Searching Documents for pyc files...'
find ~/Documents -type f -name ".pyc" -print;
echo 'Removing pyc files...'
find ~/Documents -type f -name ".pyc" -print -delete;
# =============================================================================
# SHOW & THEN REMOVE ALL MAC OS ZERO SIZED FILES
# =============================================================================
echo 'Searching Documents for ZERO file sized files...'
find ~/Documents -type f -empty;
echo 'Removing ZERO file sized files...'
find ~/Documents -type f -empty -delete;
# =============================================================================
# SHOW & THEN REMOVE Icon^M FILES
# USE THE ? MARK FOR EASE OF USE YOU CAN ALSO SUB 'CTRL + V & CTRL + M' FOR ^M
# =============================================================================
echo 'Searching Documents for Icon files...'
find ~/Documents -type f -name 'Icon?' -print;
echo 'Removing Icon files from Documents...'
find ~/Documents -type f -name 'Icon?' -print -delete;
# SEEMINGLY THE SAME AS
# find ~/Documents -type f -size 0 -print
# find ~/Documents -type f -size 0 -print -delete
# =============================================================================
# SHOWCASE NEW FOUND EMPTY FOLDERS
# =============================================================================
echo 'Showcasing new result of existing and new found empty folders...'
find ~/Documents -type d -empty;
echo 'Deleting result of empty folders...'
find ~/Documents -type d -empty -delete;
echo 'Showcasing the removal of said, 'empty folders'...'
find ~/Documents -type d -empty;
# =============================================================================
# SHOWCASE ALL COMMANDS
# =============================================================================
# todo
# open /tmp
# echo $TMPDIR
# open ~/Library/Caches/
# echo 'Searching Documents for empty folders...'
# find ~/Documents -type d -empty -print;
# echo 'Searching Documents for DS_Store files...'
# find ~/Documents -type f -name ".DS_Store" -print;
# echo 'Removing DS_Store files...'
# find ~/Documents -type f -name ".DS_Store" -print -delete;
# echo 'Searching Documents for pyc files...'
# find ~/Documents -type f -name ".pyc" -print;
# echo 'Removing pyc files...'
# find ~/Documents -type f -name ".pyc" -print -delete;
# echo 'Searching Documents for ZERO file sized files...'
# find ~/Documents -type f -empty;
# echo 'Removing ZERO file sized files...'
# find ~/Documents -type f -empty -delete;
# echo 'Searching Documents for Icon files...'
# find ~/Documents -type f -name 'Icon?' -print;
# echo 'Removing Icon files from Documents...'
# find ~/Documents -type f -name 'Icon?' -print -delete;
# echo 'Showcasing new result of existing and new found empty folders...'
# find ~/Documents -type d -empty;
# echo 'Deleting result of empty folders...'
# find ~/Documents -type d -empty -delete;
# echo 'Showcasing the removal of said, 'empty folders'...'
# find ~/Documents -type d -empty;