RE: Post Processing Scripts ยป cleanup.sh
1 |
#!/bin/bash
|
---|---|
2 |
FILES=/video/Recordings/*/*.edl |
3 |
for f in $FILES |
4 |
do
|
5 |
# take action on each file. $f store current file name
|
6 |
base=$(echo "$f" | sed "s/....$//") # Remove file ext (4 char) |
7 |
if [ -f $base.ts ]; then |
8 |
echo "Stream File $base.ts Still exists ; nothing to cleanup" |
9 |
else
|
10 |
echo "Stream File $base.ts Does not exist ; remove all others related" |
11 |
rm $base.* |
12 |
fi
|
13 |
done
|
14 |
|
15 |
FILES=/video/Recordings/*/*.csv |
16 |
for f in $FILES |
17 |
do
|
18 |
# take action on each file. $f store current file name
|
19 |
base=$(echo "$f" | sed "s/....$//") # Remove file ext (4 char) |
20 |
if [ -f $base.ts ]; then |
21 |
echo "Stream File $base.ts Still exists ; nothing to cleanup" |
22 |
else
|
23 |
echo "Stream File $base.ts Does not exist ; remove all others related" |
24 |
rm $base.* |
25 |
fi
|
26 |
done
|
27 |
|
28 |
FILES=/video/Recordings/*/*.log |
29 |
for f in $FILES |
30 |
do
|
31 |
# take action on each file. $f store current file name
|
32 |
base=$(echo "$f" | sed "s/....$//") # Remove file ext (4 char) |
33 |
if [ -f $base.ts ]; then |
34 |
echo "Stream File $base.ts Still exists ; nothing to cleanup" |
35 |
else
|
36 |
echo "Stream File $base.ts Does not exist ; remove all others related" |
37 |
rm $base.* |
38 |
fi
|
39 |
done
|
40 |
|
41 |
find /video/Recordings/ -type d -empty -exec rmdir {} \; |