SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FileSize

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
FileSize
Author Message
Sean Hicken



Joined: 03 Dec 2002
Posts: 11

Post FileSize Reply with quote

I get a File Not Found error if I try to call the FileSize function with a file that is 10,503,043,072 bytes.

I am checking this file size to ensure that is is an appropriate size before I drop my oracle instance and import this file.

Is this bug due to the fact that this number is larger than a signed long can handle?

Thank you,
Sean Hicken.

Mon Apr 28, 2003 2:59 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7968

Post Re: FileSize Reply with quote

Do you specify full or partial file name?
Do you use "\" escape symbols in the file name?

: I get a File Not Found error if I try to call the FileSize function with a
: file that is 10,503,043,072 bytes.

: I am checking this file size to ensure that is is an appropriate size before
: I drop my oracle instance and import this file.

: Is this bug due to the fact that this number is larger than a signed long can
: handle?

: Thank you,
: Sean Hicken.

Mon Apr 28, 2003 3:48 pm View user's profile Send private message
Sean Hicken



Joined: 03 Dec 2002
Posts: 11

Post Re: FileSize Reply with quote

: Do you specify full or partial file name?
: Do you use "\" escape symbols in the file name?

The following script is what I'm doing:

//-------------------------------------------------------------------------------------------------
// Verify CNETPR export file size is reasonable - ie > 1GB in size
//-------------------------------------------------------------------------------------------------
Dim ImportFileSize, number
Dim CNETPRFileName, string, "E:\\CARESnet\\ora_export\\CNETPR\\Current\\CNETPR_26Apr2003_03_00.exp"

FileSize( CNETPRFileName, ImportFileSize )
IsLessOrEqual( ImportFileSize, 1000000000, bln )

ChooseCase bln, END_FS
Case True

// File is too small - probably invalid

ConcatEx( "CNETPR export file size = ", ImportFileSize, ", this does not appear to be a valid CNETPR export file", strMsg )

RaiseError strMsg

END_FS:

Mon Apr 28, 2003 4:32 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7968

Post Re: FileSize Reply with quote

Your script seems to be ok. I am not sure if FileSize can return correctly size of files having 4+ GB. It possible internally uses 32-bit integer number to fetch and return file size. A 32-bit integer is limited to 4Gb which can cause the problem.

Try the following workaround

// Run dir command
Dim PID, number
Dim DirCmd, string
ConcatEx "cmd /c dir /-c ", CNETPRFileName, " > dir.log", DirCmd
RunAndWait DirCmd, "", 0, PID

// Read output
Dim Output, string
FileReadLine "dir.log", 6, Output
// Extract size
Dim Temp, string
// date
GetToken Output, " ", Temp
// time
GetToken Output, " ", Temp
// size
Trim Output, Output
GetToken Output, " ", ImportFileSize

/////////////////////////////
Use ImportFileSize as desired

: The following script is what I'm doing:
: //-------------------------------------------------------------------------------------------------
: // Verify CNETPR export file size is reasonable - ie > 1GB in size
:
: //-------------------------------------------------------------------------------------------------
: Dim ImportFileSize, number
: Dim CNETPRFileName, string,
: "E:\\CARESnet\\ora_export\\CNETPR\\Current\\CNETPR_26Apr2003_03_00.exp"

: FileSize( CNETPRFileName, ImportFileSize )
: IsLessOrEqual( ImportFileSize, 1000000000, bln )

: ChooseCase bln, END_FS
: Case True

: // File is too small - probably invalid

: ConcatEx( "CNETPR export file size = ", ImportFileSize, ",
: this does not appear to be a valid CNETPR export file", strMsg )

: RaiseError strMsg

: END_FS:

Mon Apr 28, 2003 5:23 pm View user's profile Send private message
Sean Hicken



Joined: 03 Dec 2002
Posts: 11

Post Re: FileSize Reply with quote

: Your script seems to be ok. I am not sure if FileSize can return correctly
: size of files having 4+ GB. It possible internally uses 32-bit integer
: number to fetch and return file size. A 32-bit integer is limited to 4Gb
: which can cause the problem.

: Try the following workaround

: // Run dir command
: Dim PID, number
: Dim DirCmd, string
: ConcatEx "cmd /c dir /-c ", CNETPRFileName, " >
: dir.log", DirCmd
: RunAndWait DirCmd, "", 0, PID

: // Read output
: Dim Output, string
: FileReadLine "dir.log", 6, Output
: // Extract size
: Dim Temp, string
: // date
: GetToken Output, " ", Temp
: // time
: GetToken Output, " ", Temp
: // size
: Trim Output, Output
: GetToken Output, " ", ImportFileSize

: /////////////////////////////
: Use ImportFileSize as desired

Thanks, I'll use your suggested work-around.
Sean.

Mon Apr 28, 2003 7:29 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.