SECFileSystem Class
class SECFileSystem: public CObject
SECFileSystem is a class designed to provide access to common filesystem functions such as reading a directory or copying a file. You can also access parsing, GUI, and CStringList functions.
See the FILEDEMO sample in the \SAMPLES\TOOLKIT\STANDARD\UTILITY\FILEDEMO directory for a demonstration of this class.
Defined in: filesys.h
Class Members
Creation/Initialization
Constructs a SECFileSystem object.
Attributes
enum Attribute
File attributes
File Operations
BOOL CompareFiles(const CString& FileName1, const CString& FileName2, const unsigned long lBuffSize = 10240)
Compares the contents of one file with another.
BOOL CopyFile(const CString& SourceFileName, const CString& DestFileName, const unsigned long lBuffSize = 10240)
Copies the contents of one file to another.
BOOL CopyFiles(const CString& FileSpec, const CString& DestPath, const BOOL bIgnoreErrors = FALSE, const unsigned long eFileAttrib = normal)
Copies more than one file to another subdirectory.
BOOL DeleteFile(const CString& FileName)
Deletes a files.
BOOL DeleteFiles(const CString& FileSpec, const unsigned long eFileAttrib = normal)
Deletes specified files (i.e., *.txt).
BOOL FileExists(const CString& PathAndFileName)
Determines if a file exists.
BOOL GetFileAccessTime(const CString& FileName, CTime& time)
Returns the time and date the file was last accessed.
BOOL GetFileAttribute(const CString& FileName, BYTE& Attribute)
Returns the attribute bits for the file.
BOOL GetFileCreateTime(const CString& FileName, CTime& time)
Returns the time and date the file was created.
BOOL GetFileModifyTime(const CString& FileName, CTime& time)
Returns the time and date the file was last modified.
BOOL GetFileSize(const CString& FileName, unsigned long& lSize)
Returns the size of the file in bytes.
BOOL GetFileStatus(const CString& FileName, CFileStatus& FileStatus)
Returns the file status.
BOOL RenameFile(const CString& OldFileName, const CString& NewFileName)
Renames a file.
BOOL GetFileCreateTime(const CString& FileName, COleDateTime& time)
Returns the time and date the file was created.
BOOL GetFileAccessTime(const CString& FileName, COleDateTime& time)
Returns the time and date the file was last accessed.
BOOL GetFileModifyTime(const CString& FileName, COleDateTime& time)
Returns the time and date the file was last modified.
Parsing Operations
CString AppendWildcard(const CString& Path, const CString& Wildcard)
Appends a wildcard to a path.
CString GetBaseFileName(const CString& PathAndFileName)
Returns the filename without path or extension.
CString GetExtension(const CString& PathAndFileName)
Returns the extension of the filename.
CString GetFileName(const CString& PathAndFileName)
Returns the filename and extension of a filespec.
CString GetFileSystem(const CString& PathAndFileName)
Returns the filesystem of the specified filespec.
CString GetFullPathName(const CString& PathAndFileName)
Expands the specified filespec into a full path.
CString GetPath(const CString& PathAndFileName, const BOOL bIncludeFileSystem = TRUE)
Returns the path of the specified filespec.
Directory Reading Operations
CStringList* GetDirectory(const CString& SearchString, const unsigned long eFileAttrib, const BOOL bRecurseSubDirs=FALSE, CStringList *pStringList = NULL)
Returns a list of files based on a filespec.
CString* GetDirectoryEntry(const CString& Wildcard = "", const unsigned long eFileAttrib = normal)
Returns a single directory entry.
CStringList* GetFileList(const CString& SearchString, const unsigned long eFileAttrib)
Returns a list of files in the specified directory.
CStringList* GetSubdirList(const CString& SearchDir, const BOOL bPathInName = TRUE)
Returns a list of directories in the specified directory.
Directory Operations
BOOL CompareDirectories(const CString& PathName1, const CString& PathName2, const BOOL bRecurseSubdirs = FALSE, const BOOL bCompareFileContents = FALSE, const unsigned long eFileAttrib = normal)
Compares the file names, sizes, and contents of two directories.
BOOL ChangeDirectory(const CString& NewDirectory)
Changes the current working directory.
BOOL DeleteDirectory(const CString& Directory, const BOOL bDeleteFilesAndDirs = FALSE)
Deletes a directory and all its files and subdirectories.
BOOL DirectoryExists(const CString& Path)
Determines if the specified directory exists.
CString GetCurrentDirectory(const CString& FileSystem = "")
Returns the current directory name.
LONG GetDirectorySize(const CString& Directory = "", const CString& WildCard = "*.*", const BOOL bRecurseSubdirs = FALSE)
Returns the number of bytes in all the files in a directory.
BOOL MakeDirectory(const CString& NewDirectory)
Creates a subdirectory.
BOOL MakePath(const CString& NewDirectory)
Makes a subdirectory (including all intervening dirs necessary).
BOOL RenameDirectory(const CString& OldName, const CString& NewName)
Renames a directory.
File System Operations
BOOL ChangeFileSystem(const CString& FileSystem)
Changes the current filesystem.
CString GetCurrentFileSystem()
Returns the current filesystem.
CStringList* GetFileSystemList()
Returns a list of available filesystems.
LONG GetFileSystemType(const CString& FileSystem)
Returns the type of the specified filesystem.
LONG GetFreeSpace(const CString& FileSystem)
Returns the number of available bytes on the specified filesystem.
ifndef UNDER_CE
Returns the number of available bytes on the specified filesystem.
BOOL FileSystemExists(const CString& FileSystemName)
Returns whether the specified file system exists.
LONG GetTotalSpace(const CString& FileSystem)
Returns the number of bytes (used and unused) on the specified filesystem.
ifndef UNDER_CE
Returns the number of bytes (used and unused) on the specified filesystem.
CString GetVolumeLabel(const CString& FileSystem)
Returns the volume label of the specified filesystem.
BOOL IsReadOnlyFileSystem(const CString& FileSystem)
Determines if the specified filesystem is writeable.
MFC GUI Operations
static void LoadComboBox(CComboBox *pComboBox, const CStringList * pStringList)
Insert the members of a CStringList into a combo box.
static void LoadListBox(CListBox *pListBox, const CStringList * pStringList)
Insert the members of a CStringList into a list box.
MFC StringList Operations
static void Sort(CStringList *pStringList, BOOL bCase = TRUE)
Sort a CStringList.