The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum. |
Getting File Size |
Post Reply |
Author | |
jabarney7
Newbie Joined: November 06 2012 Location: United States Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: January 10 2019 at 10:43am |
I have looked through some of the code but am not seeing a clear way to capture the file size from a local machine. We have users that would like to have the size of a file tested before attempting an upload so that they can split the file if it is too large. Is there an easy way to do this?
|
|
Shrek59
Senior Member Joined: December 04 2006 Location: New Zealand Status: Offline Points: 208 |
Post Options
Thanks(1)
|
Have a look through the Visual Basic Reference (Help > Documentation > Visual Basic Reference). It looks to me as if the function you need is: FileLen(Name$) To use this function, look at the ATTESTFILE script in the SAMPLES folder. You should be able to adapt that script to do what you want. Note: According to the documentation, you will get a run-time error from FileLen if the file does not exist. On that basis, you should test that the file DOES exist before you test the file length. HTH, Brian
|
|
jabarney7
Newbie Joined: November 06 2012 Location: United States Status: Offline Points: 5 |
Post Options
Thanks(0)
|
That worked terrifically! Using '-1' to signify that a file doesn't exist, anything else gives the current filesize. Cheers
SCR='On Error Resume Next' SCR=SCR:CHAR(25):'X = 0' SCR=SCR:CHAR(25):'L = -1' SCR=SCR:CHAR(25):'X = Abs(FileExists("':PATH:'"))' SCR=SCR:CHAR(25):'If X <> 0 Then' SCR=SCR:CHAR(25):'L = FileLen("':PATH:'")' SCR=SCR:CHAR(25):'End If' SCR=SCR:CHAR(25):'InitSession.Output Cstr(L) & Chr$(13)' ECHO OFF CRT CHAR(27):CHAR(2):'P':SCR:CHAR(13): |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |