OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_13/usb_fpga_2_13/trunk

Subversion Repositories usb_fpga_2_13

[/] [usb_fpga_2_13/] [trunk/] [examples/] [usb-fpga-2.04/] [2.04b/] [intraffic/] [fpga/] [clean.sh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
#!/bin/bash
2
 
3
# This files / directories from this directory will not be removed
4
# Filenames with spaces or other spuid characters will be ignored
5
sourcefiles="*.vhd *.ucf *.sh *.ise *.bit *.bin *.xise"
6
subdirs="ipcore_dir"
7
 
8
# This sould not be edited.
9
list_files() {
10
    if [ "$2" != "" ]; then
11
        echo "$1"
12
        for i in $2; do
13
            echo "  $i"
14
        done
15
    fi
16
}
17
 
18
rmfiles=""
19
rmdirs=""
20
keepfiles=""
21
keepdirs=""
22
allfiles=`ls -A`
23
for f in $allfiles; do
24
    keep=false
25
    for i in $sourcefiles; do
26
        if [ "$i" == "$f" ]; then
27
            keep=true
28
        fi
29
    done
30
    for i in $subdirs; do
31
        if [ "$i" == "$f" ]; then
32
            keep=true
33
        fi
34
    done
35
    if [ -d "$f" ]; then
36
        if $keep; then
37
            keepdirs+=" $f"
38
        else
39
            rmdirs+=" $f"
40
        fi
41
    fi
42
    if [ -f "$f" ]; then
43
        if $keep; then
44
            keepfiles+=" $f"
45
        else
46
            rmfiles+=" $f"
47
        fi
48
    fi
49
done
50
 
51
echo
52
echo "Directory $PWD:"
53
list_files "This directories will NOT be removed:" "$keepdirs"
54
list_files "This files will NOT be removed:" "$keepfiles"
55
list_files "This directories will be removed:" "$rmdirs"
56
list_files "This files will be removed:" "$rmfiles"
57
 
58
if [ "$rmfiles" == "" -a "$rmdirs" == "" ]; then
59
    c="yes"
60
else
61
    echo -n 'Confirm this by entering "yes": '
62
    read c
63
fi
64
 
65
if [ "$c" == "yes" ]; then
66
    [ "$rmfiles" != "" ] && rm $rmfiles
67
    [ "$rmdirs" != "" ] && rm -r $rmdirs
68
 
69
    for d in $subdirs; do
70
        if [ -x "$d/clean.sh" ]; then
71
            cd $d
72
            ./clean.sh || exit 1
73
            cd ..
74
        fi
75
    done
76
 
77
    exit 0
78
fi
79
exit 1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.