Dear,
At first run, the following code can delete the temp_grp.txt.
When I run it second time, it shows:error deleting "./temp_grp.txt": permission denied.
the following is codes.
wipe
set val1 [clock seconds];
set file_ID "Param_test1.txt"
set comments "#"
set file [open [format "%s" $file_ID] "r"]
set count_grp 0
while {-1 != [gets $file line] } {
if { [string first "#" $line] != 0 } {
set count_grp [expr $count_grp + 1]
# wrong # args: should be "set varName ?newValue?" <---set count_grp 1 [expr $count_grp + 1]
if [catch {open ./temp_grp.txt r} field] {
#puts "field: $field"
puts stderr "no file finded,create!!"
set field [open ./temp_grp.txt w]
puts $field $count_grp
close $field
unset field
puts "record group count1: $count_grp"
} else {
set grp_seq [read $field]
if {$count_grp < $grp_seq} {
puts "count_grp < grp_seq"
close $field
unset field
continue
} else {
set field [open ./temp_grp.txt w]
puts $field $count_grp
close $field
unset field
}
# end of that if $count1 < $grp_seq
}
#########
}
}
#-----------------------------------------
#########
puts "del temp_grp.txt!!"
file delete "./temp_grp.txt"
#########
#-----------------------------------------
set val2 [clock seconds]
set elapsedTime [expr $val2-$val1]
set days [expr int($elapsedTime/86400)]
set hours [expr int(($elapsedTime-$days*86400)/3600)]
set minutes [expr int(($elapsedTime- $days*86400-$hours*3600)/60)]
set seconds [expr int($elapsedTime- $days*86400-$hours*3600-$minutes*60)]
puts "COMPLETED :"
puts "Total Time Required --> $days days $hours hours $minutes minutes $seconds seconds"
wipe
[\code]
why I cannot delete the file second time
Moderators: silvia, selimgunay, Moderators
why I cannot delete the file second time
Kai Zhang
------------------------------
PH.D. candidate
School of Civil Engineering&Architecture
Beijing Jiaotong University
------------------------------
PH.D. candidate
School of Civil Engineering&Architecture
Beijing Jiaotong University
Re: why I cannot delete the file second time
what operating system are you using?
Re: why I cannot delete the file second time
thank you, Frank!
Xp and win7, Both of them is 64 bit system.
Sometimes, the error that cannot delete the temp_recovery file would stop the batch process.
Cheers
Ken
Xp and win7, Both of them is 64 bit system.
Sometimes, the error that cannot delete the temp_recovery file would stop the batch process.
Cheers
Ken
Kai Zhang
------------------------------
PH.D. candidate
School of Civil Engineering&Architecture
Beijing Jiaotong University
------------------------------
PH.D. candidate
School of Civil Engineering&Architecture
Beijing Jiaotong University