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

powered by: WebSVN 2.1.0

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