Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get File Size

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi all,
Having a very stupid moment. I can't seem to sort out how to get the size of a file. I have looked through help, and thought ADIR() was on the right track, but can't seem to get it out of that.

What I'm trying to do is get the size of a file, in bytes when I pick a file from GETFILE(). I expected to get the JUSTFNAME() from picking it, and then check against that file where it came from to get its size into some value that I could then do a REPLACE into the table (i.e. REPLACE DOCUMENT.DOCUMENTFILESIZE With lnFileSize where I calculated (string captured) the size from some element that will tell me the file's size.
But I find no function suitable. Any idea how to get this?


Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
ADIR is the right choice, why?
Code:
If ADIR(aSize,GETFILE())=1
   ? aSize[1,2]
Endif
You need the full file name. Remember what I said when working with files? Remember the differing opinions we had? You can store relative paths to make your data movable keeping relative locations. But for gods sake, when you want the file content or attributes, the easiest to get at it is using the current absolute path.

So if you dont start from GETFILE() but from your file data relative path, add the relative path to the base path to get the absolute filename and use it as file skeleton and you don't only get confirmation the file still exists there, the file attributes are also in the array ADIR generates.

Bye, Olaf.
 
Olaf. you were right again. The fully qualified path was not getting supplied, and now it is, works like a charm.
CHeers.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top