-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrm_n.sh
28 lines (25 loc) · 779 Bytes
/
rm_n.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
#!/bin/sh
# +5 for all files with size >5 bytes
# 5 for all files with size exactly 5 bytes
# -5 for all files with size <5 bytes
# rm_n.sh
echo "The list of files are:-\n"
echo "---------------------------------------------------"
find -s $1 -type f -size $2 &&
echo "\n---------------------------------------------------\n"
while true; do
echo "\nDo you want to delete all of these files[Y/N]? " &&
read choice &&
case $choice in
[Yy] ) echo "Deleting all the files with size $2\n";
find -s $1 -type f -size $2 -delete &&
break;;
[Nn] ) echo "exiting...";
exit;;
* ) echo "invalid response";;
esac
done
echo "Deleted all the files in this directory below $2 bytes"
#
# Created by Aditya Kumar Singh(@sadityakumar9211) on 22/10/22.
#