File: clean_cwd.sh

package info (click to toggle)
cp2k 6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 204,532 kB
  • sloc: fortran: 835,196; f90: 59,605; python: 9,861; sh: 7,882; cpp: 4,868; ansic: 2,807; xml: 2,185; lisp: 733; pascal: 612; perl: 547; makefile: 497; csh: 16
file content (46 lines) | stat: -rwxr-xr-x 1,443 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# clean_cwd: Cleans the current working directory and all its subdirectories from scratch files,
#            i.e. files which are not committed to SVN
echo "The directory $PWD is cleaned from scratch files"
if [[ $1 == "-f" ]]; then
  echo "NOTE: You requested to remove all files without being prompted"
fi
for file in $(svn status | grep '? ' | awk '{print $2}'); do
  if [[ -d ${file} ]]; then
    if [[ $1 == "-f" ]]; then
      rm -rf ${file}
      echo Directory ${file} removed
    elif [[ $1 == "-i" ]]; then
      rm -ir ${file}
    else
      rm -r ${file}
      echo Directory ${file} removed
    fi
  elif [[ -f ${file} ]]; then
    if [[ $1 == "-f" ]]; then
      rm -f ${file}
      echo File ${file} removed
    elif [[ $1 == "-i" ]]; then
      rm -i ${file}
    else
      if [[ ${file##*.} == "inp" ]]; then
        echo "This files could be a new input file. Do you really want to delete it?"
        rm -i ${file}
      elif [ ${file##*.} == "sopt" ] ||
           [ ${file##*.} == "popt" ] ||
           [ ${file##*.} == "sdbg" ] || 
           [ ${file##*.} == "pdbg" ] ||
           [ ${file##*.} == "ssmp" ] ||
           [ ${file##*.} == "psmp" ]; then
        echo "This files could be a new arch file. Do you really want to delete it?"
        rm -i ${file}
      else
        rm -f ${file}
        echo File ${file} removed
      fi
    fi
  else
    echo Unknown object ${file} found
    exit
  fi
done