|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 #!/usr/bin/perl |
|
17 use File::Copy; |
|
18 use File::Find; |
|
19 |
|
20 print("Start to move localized xuikon odts to folders named by language number\n"); |
|
21 |
|
22 # go through all directories and subdirectories |
|
23 find(\&MoveLocalized, '.'); |
|
24 |
|
25 sub MoveLocalized |
|
26 { |
|
27 # if we are in hsps folder move localized xuikon odts |
|
28 if ($File::Find::name =~ /\/hsps\//g) |
|
29 { |
|
30 #print("Processing folder $File::Find::dir\n"); |
|
31 $File::Find::prune = 1; |
|
32 # move localized xuikon odts to folders named by language index |
|
33 while(<*.o*>) |
|
34 { |
|
35 # Find position of suffix (search for ".o") |
|
36 $suffix = $_; |
|
37 $suffix =~ /\.o/g; |
|
38 |
|
39 # name of localized dir is last four characters of file |
|
40 $dirname = substr($_, pos($suffix), 4); |
|
41 # don't move engineering english version |
|
42 if ($dirname != "0000") |
|
43 { |
|
44 print("\nold file = $File::Find::dir/$_\n"); |
|
45 # remove zeros from beginning |
|
46 $dirname += 0; |
|
47 # create folder |
|
48 mkdir($dirname); |
|
49 # move file to folder and rename it |
|
50 $newlocation = $dirname ."/" .$_; |
|
51 move($_, $newlocation); |
|
52 $oldname = $newlocation; |
|
53 $newlocation =~ s/\.o(.*)$/\.o0000/; |
|
54 print("new file = $File::Find::dir/$newlocation\n"); |
|
55 rename $oldname, $newlocation; |
|
56 } |
|
57 } |
|
58 } |
|
59 } |
|
60 |
|
61 |
|
62 exit; |