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

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [examples/] [usb-fpga-1.2/] [ucecho/] [fpga/] [clean.sh] - Blame information for rev 2

Go to most recent revision | 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"
6
 
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 $binfiles; do      # binfiles is set by distclean.sh
31
        if [ "$i" == "$f" ]; then
32
            keep=false
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
 
52
list_files "This directories will NOT be removed:" "$keepdirs"
53
list_files "This files will NOT be removed:" "$keepfiles"
54
list_files "This directories will be removed:" "$rmdirs"
55
list_files "This files will be removed:" "$rmfiles"
56
 
57
if [ "$rmfiles" == "" -a "$rmdirs" == "" ]; then
58
    exit 0
59
fi
60
 
61
echo -n 'Confirm this by entering "yes": '
62
read c
63
if [ "$c" == "yes" ]; then
64
    [ "$rmfiles" != "" ] && rm $rmfiles
65
    [ "$rmdirs" != "" ] && rm -r $rmdirs
66
    exit 0
67
fi
68
exit 1
69
 
70
 

powered by: WebSVN 2.1.0

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