-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcreatelist
More file actions
48 lines (36 loc) · 731 Bytes
/
createlist
File metadata and controls
48 lines (36 loc) · 731 Bytes
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
#!/bin/bash
FOUNDLST=""
DIR1="/home/smallwolfie/test/archives"
DIR2="/home/smallwolfie/test/isos"
TARGZ=""
ISO=""
create_list() #$1 - dir, $2 - file mask
{
FOUNDLST=""
for FLE in $(find $1 -maxdepth 1 -iname $2); do
if [ -n "$FLE" ]; then
FOUNDLST="$FOUNDLST"`basename $FLE`"\n"
fi
done
}
create_list $DIR1 "*.tar.gz"
if [ -z "$FOUNDLST" ]; then
echo "$DIR1 *.tar.gz not found"
else
TARGZ=$FOUNDLST
fi
create_list $DIR2 "*.iso"
if [ -z "$FOUNDLST" ]; then
echo "$DIR2 *.iso not found"
else
ISO=$FOUNDLST
fi
create_list $DIR2 "*.zip"
if [ -z "$FOUNDLST" ]; then
echo "$DIR2 *.zip not found"
fi
echo "*.tar.gz:"
echo -e -n "$TARGZ"
echo "-----------"
echo "*.iso:"
echo -e -n "$ISO"