Bonjour à tous


aujourd'hui j'ai un petit problème au niveau de mon script

lorsque à la fin de mes actions je supprime mes fichiers temporaires il ne supprime pas tout

en effet
la fonction rmfile s execute correctement certains fichiers sont éffacés mais pas tous...

Avez vous une idée de ce qui pourrait causer cela ?

Car selon mon script
les fichiers sources commençant par ${code} devraient tous etre éffacé ce qui ne st pas le cas.






Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
 
#!/bin/ksh
# i24246 13/12/2011 mov fichierXFB
#set -x
NORMAL="\\033[0;39m"
SUCCESS="\\033[1;32m"
WARNING="\\033[1;33m"
FAILURE="\\033[1;31m"
HIGHLIGHT="\\033[1;1m"
source=/data/se-MQSI/se-xf-in/
dest=/data/se-MQSI
i=0
NbrB=2
rmfile()
                {
                        for code in $appcd
                        do
 
            if [ -s ${source}script/${code}.files ]
            then
                        rm -f ${source}script/${code}.files
                        if [ $? -eq 0 ]
                        then
                                        echo "$HIGHLIGHT\n rm -f ${source}script/${code}.files  \t\t\t\t\t\t [$SUCCESS OK $NORMAL]"
 
                        else
                            echo "$HIGHLIGHT\n rm -f ${source}script/${code}.files  \t\t\t\t\t\t [$FAILURE KO $NORMAL]"
                        fi
                        fi
                        echo suppression de ${source}script/${code}
                        if [ -s ${source}script/$code ]
            then
                        rm -f ${source}script/${code}*
                        if [ $? -eq 0 ]
                        then
                                        echo "$HIGHLIGHT\n rm -f ${source}script/${code}  \t\t\t\t\t\t [$SUCCESS OK $NORMAL]"
 
                        else
                            echo "$HIGHLIGHT\n rm -f ${source}script/${code}  \t\t\t\t\t\t [$FAILURE KO $NORMAL]"
                        fi
                        fi
                        echo suppression de $dest/se-FROM-${code}/*.files
                        if [ -s $dest/se-FROM-${code}/${code}.files ]
            then
                        rm -f $dest/se-FROM-${code}/${code}.files
                        if [ $? -eq 0 ]
                        then
                                        echo "$HIGHLIGHT\n rm -f $dest/se-FROM-${code}/*.files   \t\t\t\t\t\t [$SUCCESS OK $NORMAL]"
 
                        else
                            echo "$HIGHLIGHT\n rm -f $dest/se-FROM-${code}/*.files        \t\t\t\t\t\t [$FAILURE KO $NORMAL]"
                        fi
                        fi
                        echo suppression de $dest/se-FROM-${code}/${code}
                        if [ -s $dest/se-FROM-${code}/${code} ]
            then
                        rm -f $dest/se-FROM-${code}/${code}
                        if [ $? -eq 0 ]
                        then
                                        echo "$HIGHLIGHT\n rm -f $dest/se-FROM-${code}/${code}  \t\t\t\t\t\t [$SUCCESS OK $NORMAL]"
 
                        else
                            echo "$HIGHLIGHT\n rm -f $dest/se-FROM-${code}/${code}  \t\t\t\t\t\t [$FAILURE KO $NORMAL]"
                        fi
                        fi
                        done
                }
Check()
{
if [ $? -eq 0 ]
                        then
                                        echo "$HIGHLIGHT\n Copying/Moving from $source$line to $dest/se-FROM-$code/$$.$line \t\t\t\t\t\t [$SUCCESS OK $NORMAL]"
 
                        else
                            echo "$HIGHLIGHT\nCopying/Moving Files $ from $source$line to $dest/se-FROM-$code/$$.$line \t\t\t\t\t\t [$FAILURE KO $NORMAL]"
 
fi
}
Subfolder()
{
DF=`ls $dest/se-FROM-ISIS/ISIS*`
for isif in $DF
        do
                echo $isif
                LD=`echo $isif | cut -c35`
 
                echo $LD
 
 
                        if [ "$LD" == "U" ]
                                then
                                mv $isif $dest/se-FROM-$code/urgent-pay/$line
                        fi
                        if [ "$LD" == "P" ]
                                then
                                mv $isif $dest/se-FROM-$code/normal-pay/$line
                        fi
                        if [ "$LD" == "A" ] || [ "$LD" == "H" ]
                                then
                                mv $isif $dest/se-FROM-$code/admin-dat/$line
                        fi
        done
}
 
while [ "$i" -ne "$NbrB" ];
do
appcd="EGTF FBCP FBLC ISIS KLFI IY99"
        for code in $appcd
                do
                        echo ${source}script/$code
                        touch ${source}script/$code
                        chmod 777 ${source}script/$code
                        ls $code* > ${source}script/$code.files
                        chmod 777 ${source}script/$code.files
                        if [[ $? -eq 0 ]]
                                        then
                                        echo ${source}script/$code.files created successfully !!!
                                        cat ${source}script/$code.files
                                        fi
 
                                if [[ -s ${source}script/${code}.files ]]
                                        then
                                        { while read line;do
 
                                                echo $line
 
                                                cp ${source}script/$line $dest/se-FROM-$code/$$.$line
                                                Check
                                                        if [ "$code" == "EGTF" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                                                                Check
                                                        fi
 
                                                        if [ "$code" == "FBCP" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                Check
                                        fi
                                         if [ "$code" == "IY99" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                Check
                                        fi
                                                        if [ "$code" == "KLFI" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                                                                Check
                                            fi
                                                        if [ "$code" == "FBLC" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                                                                Check
                                                        fi
                                                        if [ "$code" == "ISIS" ]
                                                                then
                                                                mv $dest/se-FROM-$code/$$.$line $dest/se-FROM-$code/$line
                                                                Check
                                                                Subfolder
                                        fi
 
 
                                        if [ "$i" == "2" ]
                then
                rmfile
                fi
 
done } < ${source}script/${code}.files
                                                else
                                                        print "\n"
                                                        print "\n"
                                                        echo $HIGHLIGHT ALL FILE FROM $source ARE PROCESSED! You are now leaving the script . . . $NORMAL
                                                        rmfile
                                                        print "\n"
 
                                                        fi
 
                done
((i=i+1))
print "\n"
                                                        print "\n"
                                                        echo $HIGHLIGHT ALL FILE FROM $source ARE PROCESSED! You are now leaving the script . . . $NORMAL
rmfile
done