Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 02-28-2004, 03:15 PM   #1
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default [iTCL] 'file size ..' returns 0 on POST STOR/RETR ?

for some reason when running itcl script on POST STOR/RETR,

Code:
set s [file size $path]
returns '0'

but on getting the size of another existing file elsewhere that hasnt just been STOR/RETR returns the size properly ? :/
bizniz is offline  
Old 02-28-2004, 03:17 PM   #2
Harm
Too much time...
Ultimate Scripter
 
Join Date: Jul 2003
Posts: 1,430
Default

What is the value of $path ?
Harm is offline  
Old 02-28-2004, 09:37 PM   #3
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

it _always_ points to directory. You need to combine arguments with path to get filename.
darkone is offline  
Old 02-28-2004, 10:04 PM   #4
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default

i know, i know .. ok, ill call the var $mypath,

$mypath IS set to a valid filename,

ie.
$mypath == "C:/this/file.r01"


try yourself, you'll see
bizniz is offline  
Old 02-28-2004, 11:18 PM   #5
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

You're doing something wrong in your code. file size works just fine here, even in post STOR event.

Test using ioisotopehelper custom command:
[FTP_Custom_Commands]
ioIsotopeHelper = TCL ..\scripts\ioIsotope.itcl

Quote:
[23:14:32] [L] site ioisotopehelper cidx
[23:14:32] [L] 200-CIDX;3;Mouton;Admins;*;127.0.0.1;pomme2k3;download ;RETR test1.rar;/race/test/;/race/test/test1.rar;2004-02-28 23:14:12;20;18;5.0;196608;15000000;
[23:14:32] [L] 200 Command successful.
Last number is file size in bytes... See code below.

Test using post stor event:
[FTP_Post-Command_Events]
stor = TCL ..\scripts\ioIsotope.itcl cidx

Quote:
[23:14:40] [L] Opening data connection IP: 127.0.0.1 PORT: 1034
[23:14:40] [L] STOR SomeHeader.h
[23:14:40] [L] 150 Opening ASCII mode data connection for SomeHeader.h.
[23:14:40] [L] CIDX;3;Mouton;Admins;*;127.0.0.1;pomme2k3;download ;RETR test1.rar;/race/test/;/race/test/test1.rar;2004-02-28 23:14:12;28;26;5.0;196608;15000000;
[23:14:43] [L] 226 Transfer complete.
[23:14:43] Transferred: SomeHeader.h 6 KB in 2.22 (2.72 KBps)
Worked too... file size = 15000000 bytes...

itcl code used:
Quote:
switch $status {
0 { set status "idle" }
1 { set status "download" ; set filesize [file size [resolve pwd [lindex $data 8]]]}
2 { set status "upload" ; set filesize [file size [resolve pwd [lindex $data 8]]]}
3 { set status "list" }
}
iputs "CIDX;[lindex $data 0];[resolve uid [lindex $data 1]];[resolve gid $gid];[lindex $data 2];[lindex $data 3];[lindex $data 4];$status;[lindex $data 6];[lindex $data 7];[lindex $data 8];$logintime;$logindiff;[lindex $data 10];[lindex $data 11];[lindex $data 12];$filesize;"
Mouton is offline  
Old 05-06-2004, 04:07 PM   #6
Ofloo
Member
 
Join Date: Jun 2003
Posts: 43
Default

not entirely sur what u want i suppose the file size of ur dir ..

PHP Code:
foreach [glob -nocomplain -type f -dir $path *] {
  if {[
info exists i]} { 
    
set i [expr [file size $x]+$i]
  } else {
    
set i [file size $x]
  }
}
return 
$i 
for main dir rerun it for every dir .. to do it restructive ..
Ofloo is offline  
Old 05-06-2004, 11:37 PM   #7
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

It's propably smarter to set i to 0, before entering that loop to remove one extra if
darkone is offline  
Closed Thread

Tags
file, post, returns, size, stor/retr

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:35 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)