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.11/] [1.11b/] [memtest/] [fpga/] [clean.sh] - Rev 7

Compare with Previous | Blame | View Log

#!/bin/bash
 
# This files / directories from this directory will not be removed
# Filenames with spaces or other spuid characters will be ignored
sourcefiles="*.vhd *.ucf *.sh *.ise *.bit *.bin *.xise"
subdirs="ipcore_dir"
 
 
# This sould not be edited.
list_files() {
    if [ "$2" != "" ]; then
	echo "$1"
	for i in $2; do
	    echo "  $i"
	done
    fi
}
 
rmfiles=""
rmdirs=""
keepfiles=""
keepdirs=""
allfiles=`ls -A`
for f in $allfiles; do
    keep=false
    for i in $sourcefiles; do
	if [ "$i" == "$f" ]; then
	    keep=true
	fi
    done
    for i in $subdirs; do
	if [ "$i" == "$f" ]; then
	    keep=true
	fi
    done
    if [ -d "$f" ]; then
	if $keep; then
 	    keepdirs+=" $f"
	else
 	    rmdirs+=" $f"
	fi
    fi
    if [ -f "$f" ]; then
	if $keep; then
 	    keepfiles+=" $f"
	else
 	    rmfiles+=" $f"
	fi
    fi
done    
 
echo
echo "Directory $PWD:"
list_files "This directories will NOT be removed:" "$keepdirs"
list_files "This files will NOT be removed:" "$keepfiles"
list_files "This directories will be removed:" "$rmdirs"
list_files "This files will be removed:" "$rmfiles"
 
if [ "$rmfiles" == "" -a "$rmdirs" == "" ]; then
    c="yes"
else    
    echo -n 'Confirm this by entering "yes": '
    read c
fi
 
if [ "$c" == "yes" ]; then
    [ "$rmfiles" != "" ] && rm $rmfiles
    [ "$rmdirs" != "" ] && rm -r $rmdirs
 
    for d in $subdirs; do
	if [ -x "$d/clean.sh" ]; then
	    cd $d
	    ./clean.sh || exit 1
	    cd ..
	fi
    done
 
    exit 0
fi    
exit 1
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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