SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Limitation on FileSize command

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Limitation on FileSize command
Author Message
DLUTER



Joined: 16 Mar 2007
Posts: 44
Country: United States

Post Limitation on FileSize command Reply with quote
I'm trying to use filesize to calculate the diskspace used by some of our backup files in a single folder. On version 3.4.24 when I use the filesize command on a file greater than 4GB in size I'm getting a byte count of 4294967295 (4GB). When I use version 3.4.31 it simply states that the file doesn't exist. Do you have a patch or a workaround for this by any chance?
Thu May 29, 2008 1:06 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6485

Post Reply with quote
I couldn't find any difference in behavior between 3.4.24 and 3.4.31. I think you came across a timing issue. As long as file is less then 4GB both versions cane return size correctly. If it is over 4GB they both fail. The reason is simple, both versions use DWORD datatype for the file size return. Obviously, any value that doesn't fit in 4 bytes causes the FileSize to fail and it returns default message "File not found"

This is a kind of legacy code developed ages ago when 2+GB files could not be stored in regular disk partition. Nowadays, files of that and larger size are not that rare, but the internal code has never been updated to support them.

I can offer 2 workarounds.
In JAL you can call the DOS dir command

Code:
Dim pid, number
Dim size,  number
Dim line, string
RunAndWait( "cmd /C dir C:\\path\\to\\my\\file.txt > C:\\temp\\temp.txt", "", 0, pid)
FileReadLine( "C:\\temp\\temp.txt", 7, line)
Trim(line, line)
Replace(line, 1, 9, "", line)
Trim(line, line)
GetToken(" ", line, size)



It is much easier in VBScript
Code:

Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("C:\\path\\to\\my\\file.txt")
MsgBox f.size


You can also use the same method(s) do get size of the entire folder. In JAL use did *.* and parse out the last line with the total bytes number. In VbScript simply replace GetFile call with GetFolder.

Code:
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\\path\\to\\my\\folder")
MsgBox f.size

Thu May 29, 2008 3:52 pm View user's profile Send private message
DLUTER



Joined: 16 Mar 2007
Posts: 44
Country: United States

Post Reply with quote
Any news on when the older code will be updated? The job I have will be scrolling over 100's of backup files.
Fri May 30, 2008 10:57 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6485

Post Reply with quote
It is likely possible to provide a fix in the next maintenance release, but unfortunately I don't have a date when that release will be available.

Can you use a VBScript based job for this task?
Fri May 30, 2008 1:02 pm View user's profile Send private message
DLUTER



Joined: 16 Mar 2007
Posts: 44
Country: United States

Post Reply with quote
For this instance i'll probably use something similiar to your JAL example.

Since everything is in one directory i'll do a "dir *.* /s > dirout.txt" to get everything and then parse the output file to grab the "Total Files Listed" entry. Convert that to a number and divide by 1073741824 (1GB) and go from there.


Total Files Listed:
32 File(s) 82,089,475,072 bytes
20 Dir(s) 1,420,386,271,232 bytes free

I'll use the vbscript for another job where i'm moving these large files to archive drives and the script needs to see if the files will fit or need to be placed on another drive.

Thanks for the help.
Fri May 30, 2008 1:12 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.