Page

B.2.2- The Folder Object

Created by Brendan Doss.
Last Updated by Brendan Doss.  

PublicCategorized as Appendix B.

Not yet tagged
<< B.2.1- The Drive ObjectAppendixBB.2.3- The File Object >>

The Folder Object

The Folder object provides access to the folders on a drive.

 

Property

Description

Attributes

Returns the attributes of the folder. Can be a combination of any of the values: Normal (0), ReadOnly (1), Hidden (2), System (4), Volume (name) (8), Directory (folder) (16), Archive (32),  Compressed (128) and Alias (1024).

 

Property

Description

DateCreated

Returns the date and time that the folder was created.

DateLastAccessed

Returns the date and time that the folder was last accessed.

DateLastModified

Returns the date and time that the folder was last modified.

Drive

Returns the drive letter of the drive on which the folder resides.

Files

Returns a Files collection containing File objects representing all the files within this folder.

IsRootFolder

Returns a Boolean value indicating if the folder is the root folder of the current drive.

Name

Sets or returns the name of the folder.

ParentFolder

Returns the Folder object for the parent folder of this folder.

Path

Returns the absolute path of the folder, using long file names where appropriate.

ShortName

Returns the DOS-style 8.3 version of the folder name.

ShortPath

Returns the DOS-style 8.3 version of the absolute path of this folder.

Size

Returns the size of all files and subfolders contained in the folder.

SubFolders

Returns a Folders collection consisting of all folders contained in the folder, including hidden and system folders.

Type

Returns a string that is a description of the folder type (such as "Recycle Bin") if available.

 

Method

Description

Copy(destination,
          overwrite)

Copies this folder and all its contents to the folder specified in destination, including all the files contained in this folder. If destination ends with a path separator character ('\') then destination is assumed to be a folder into which the copied folder will be placed, otherwise it is assumed to be a full path and name for a new folder to be created. An error will occur if the destination folder already exists and the optional overwrite parameter is set to False. The default for overwrite is True.

 

Method

Description

CreateTextFile
     (filename,
     
overwrite,
     
unicode)

Creates a new text file within this folder with the specified filename, and returns a TextStream object that refers to it. If the optional overwrite parameter is set to True, any existing file with the same name will be overwritten. The default for overwrite is False. If the optional unicode parameter is set to True, the content of the file will be stored as Unicoded text. The default for unicode is False.

Delete(force)

Deletes this folder and all its contents. If the optional force parameter is set to True the folder will be deleted even if the Read-only attribute is set on it or on any contained files. The default for force is False.

Move(destination)

Moves this folder and all its contents to the folder specified in destination. If destination ends with a path separator character ('\') then destination is assumed to be the folder in which to place the moved folder, otherwise it is assumed to be a full path and name for a new folder. An error will occur if the destination folder already exists.

<< B.2.1- The Drive ObjectAppendixBB.2.3- The File Object >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |