Files, directories and volumes
Windows (like many other) file systems organize data on hard disks and devices with the concept of files and directories.
In addition, Windows supported file systems also have the concept of volumes. A volume is a container for a file system.
Paths
A path consists of a series of directory names that optionally ends with a file name. The directory and file names are separated by a back slash:
\dirOne\dirTwo\dirThree\filename.ext
The
WinAPI I/O functions convert a forward slash to back slash except when the special
\\?\
prefix is used.
Maximum length of path names
Reserved file names
Some file names are reserved and cannot or should not be used for actual files
- CON (The console)
- PRN (Printer)
- AUX
- NUL (null device, compare with
/dev/null
on Unix/Linux)
- COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9
- LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9 (Parallel ports)
Prohibited characters in file names
The following characters are not allowed in file and directory names:
-
<
, >
(Redirection operators)
-
:
(Stream name separator)
-
"
-
/
, \
(Path separator (also forward slash?))
-
?
, *
(Wildcards)
Determining free and used space on local file systems
A quick way to determine the free and used space on local file systems with
PowerShell is
PS C:\> get-psDrive -psProvider fileSystem
Alternatively, it can also be queried with
get-wmiObject -class win32_logicalDisk | `
select-object `
deviceId, `
@{L=' Free (GB)';E={"{0,10:N1}" -f ($_.freeSpace /1GB)}}, `
@{L='Total (GB)';E={"{0,10:N1}" -f ($_.size /1GB)}}