Properties and Methods of File Object
Properties of File.
Property
Description
Attributes
Returns attributes for the file which may be Normal(0), ReadOnly(1),
Hidden(2), System(4), Volume(name)(8), Directory(File)(16), Archive(32),
Alias(64) or Compressed(128).
DateCreated
Returns date and time when file was created.
DateLastAccessed
Returns date and time when file was last accessed.
DateLastModified
Returns date and time when file was last modified.
Drive
Returns Drive object where the file resides.
Name
Sets or returns name of the file.
ParentFolder
Returns Folder object for the parent folder of this file.
Path
Returns complete path for the file.
ShortName
Returns DOS style 8.3 version of file name.
ShortPath
Returns DOS style 8.3 version of file path.
Size
Returns size of the file in bytes.
Type
Returns a descriptive string for the current file.
Methods of File.
Method
Description
Copy(destination, overwrite)
Copies this file to destination.
Delete(force)
Deletes the current file.
Move(destination)
Moves the file to destination.
CreateTextFile(name, overwrite, unicode)
Creates a new text file under the current folder and returns a TextStream
object for this file. If overwrite argument is
True then existing file with same name is deleted. unicode
argument is optional.
OpenAsTextStream(iomode, format)
Opens a file for reading(1), writing(2) or appending(8) and returns a TextStream
object for this file.
Properties and Methods of TextStream Object
Properties of TextStream.
Property
Description
AtEndOfLine
Returns True if file pointer is at the end of line.
AtEndOfStream
Returns True if file pointer is at the end of file.
Column
Returns column number for the current character in the file starting from 1.
Line
Returns current line number within the file starting from 1.
Methods of TextStream.
Method
Description
Close()
Closes the open file.
Read(numOfCharacters)
Reads specified number of characters from a file.
ReadAll()
Reads the content of the file and returns a single string.
ReadLine()
Reads one line of the file.
Skip(numOfCharacters)
Skips through the numOfCharacters when reading through a file.
SkipLine()
Skips the current line and moves to the next line.
Write(string)
Writes given string to the file.
WriteLine(string)
Writes a string and appends new line character after it.
In order to post questions/comments, you must be logged-in. If you are not a member
yet, then signup, otherwise login. Once you
login then come back to this page and you'll see a form right here which will allow you
to post comments/questions.
Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a
reply to the thread you have subscribed.