PowerShell: create directory
Create New Directory
mkdir dirName
🟢 TIP:
mkdir is a builtin function, not a
Cmdlet
, not alias.
Full syntax to make a directory:
New-Item dirName -ItemType directory # dirName can be name or full path
Hide the Output
In a script, it is annoying that mkdir prints output. You can surrpress the output.
mkdir dirName | out-null
out-null suppress the useless info about the fact you created a directory.
More efficient way to hide output:
$null = mkdir dirName
PowerShell. Create New File or Dir
PowerShell. List Dirs and Files
List Dirs
- PowerShell: navigate directory
- PowerShell: show current dir path
- PowerShell: list directories
- PowerShell: show directory as tree
- PowerShell: list empty dir 📜
- PowerShell: dir size 📜
List Files
- PowerShell: list files
- PowerShell: show fullpath, no truncate lines
- PowerShell: list empty files 📜
- PowerShell: count files
- PowerShell: list files by wildcard name pattern
- PowerShell: filter file name by regular expression
- PowerShell: sort files by size
- PowerShell: list large files 📜
- PowerShell: sort files by date
- PowerShell: search text in files (grep)