Accessing Properties of a file

I need to access the properties of a file.

You know when right-clicking a file and go to Properties, It displays a bwindow with all the file's properties.

I need to access that.

Please help, Examples will be a apreciated.

Chemical X
Chemical_xAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
NoCloneGroupConnect With a Mentor Commented:
To Display the File Properties Dialog Box
http://www.freevbcode.com/ShowCode.Asp?ID=445

To Search File and Get File Property Using API Classes
http://www.freevbcode.com/ShowCode.Asp?ID=2318
0
 
uncle_medCommented:

FileLen(sPathtoFile) returns the size of the file

FileDateTime(sPathtoFile) returns the date+Time of the file


0
 
aelatikCommented:
Use API to gather File Info, dowload 'API GUIDE' from www.allapi.net ( its shipped with 900 API calls )

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20548023.html

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
iozturkCommented:
Function ShowFolderSize(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(filespec)
   s = UCase(f.Name) & " uses " & f.size & " bytes."
   ShowFolderSize = s
End Function

If you add Microsoft Scripting Runtime from references, then you see shorcut helps when typing.

But there is a bug in size (altough microsoft does not confirm and says this was by desing) size properties larger than ~2GB gives wrong results. (such as file size and free space).
0
 
uncle_medCommented:
Chemical

If you want to get even greater information on files, you can use the scripting object.


Check the following in the References menu
"Microsoft Scripting Runtime"

create a procedure and declare the following:
    Dim FSO As Scripting.FileSystemObject


type in FSO followed by a dot and you'll see a lot of methods and properties to access and manipulate files.

Hope it helps
0
 
CimperialiCommented:
Have also a look at GetAttr vb keyword
0
 
rdrunnerCommented:
Try this

dim oFSO as new filesystemobject
dim oFile as file

set oFile = ofso.getfile("c:\test.txt")

Now place a watch on oFile and explore it ;)

Try to search for File-Object in your MSDN to find what all properties mean...

0
 
CleanupPingCommented:
Chemical_x:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept NoCloneGroup's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0
All Courses

From novice to tech pro — start learning today.