































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































.\ to reference the current directory ..\ to reference the parent directory
..\Chapter.05\Complete\Temp.doc
File System (Examples)
Example to create an absolute
reference to Temp.doc in the folder named C:\Windows\Temp
mkdir C:\Windows\Temp\Temp.doc
The Path Class (Members Properties)
Typically a backslash ()
Typically a full colon (:) in Windows
The Path Class (File Information 1)
The following members get information about a file (even if it does not exist) Each member accepts a file name as its argument
GetDirectoryName gets the directory part of the file The trailing backslash is removed GetFileName gets the file name with the file extension GetExtension gets only the file extension
The Directory Class
(Current Directory)
The method accepts a string containing the directory name A DirectoryNotFound exception is thrown if the directory does not exist
The Directory Class
(Managing Directories 1)
CreateDirectory creates a directory or subdirectory A string argument is passed containing the directory name Delete deletes a directory or subdirectory The first argument contains the directory to delete The optional second argument contains True to force subdirectories and files to be deleted
The Directory Class
(Example)
Directory.CreateDirectory("C:\Demo") Directory.CreateDirectory("Demo")
Directory.Delete("C:\Demo") Directory.Delete("C:\Demo", True)
Dim Exists As Boolean Exists = Directory.Exists("C:\Demo")
Operates similarly to the Directory class Static methods create, move, and delete files Copy method copies source file to destination file Create method creates a new file Delete method deletes a file Exists method returns a Boolean value indicating whether the file exists GetAttributes and SetAttributes get and set file attributes, respectively GetCreationTime , GetLastAccessTime and GetLastWriteTime get file modification information
Pass the logical drive name ( String ) as an argument to the GetDrives constructor The method returns an array of DriveInfo types (one for each drive)