File: fixfilenames

package info (click to toggle)
bamboo 1.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 580 kB
  • ctags: 1,338
  • sloc: php: 4,061; makefile: 44; sh: 36
file content (51 lines) | stat: -rwxr-xr-x 1,072 bytes parent folder | download
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
47
48
49
50
51
#!/bin/bash

#
# converts a site's file storage to be compatible with bamboo
# version 0.3 and later.
#


if [ ! -d $1 ]; then
   echo "Usage: $0 <site directory>"
   exit
fi

cd $1
if [ ! -f 'site.prop' ]; then
  echo "The directory $1 does not appear to be a bamboo site"
  exit
fi

for f in `find . -type f`; do

filename=`basename $f`
case "$filename" in
  "content.en.txt")  new="b.en.txt";;
  "content.en.html") new="b.en.html";;
  "content.en.php")  new="b.en.php";;
  "content.es.txt")  new="b.es.txt";;
  "content.es.html") new="b.es.html";;
  "content.es.php")  new="b.es.php";;
  "content.pt.txt")  new="b.pt.txt";;
  "content.pt.html") new="b.pt.html";;
  "content.pt.php")  new="b.pt.php";;
  "basic.prop")      new="b.basic";;
  "inherit.prop")    new="b.inherit";;
  "order")           new="b.order";;
  "index.sqlite")    new="b.index.sqlite";;
  "site.prop")       new="b.site";;
  *)                 new="";;
esac

if [ "$new" != "" ]; then
  dir=`dirname $f`
  mv $f $dir/$new
else
  echo "skipping $f"
fi

done

echo "Finished upgrading bamboo site."