-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathps1
More file actions
29 lines (24 loc) · 770 Bytes
/
ps1
File metadata and controls
29 lines (24 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# checking if the directory exists
$directories = @(
"$env:USERPROFILE\3D Objects",
"$env:USERPROFILE\Pictures",
"$env:USERPROFILE\Desktop",
"$env:USERPROFILE\Documents",
"$env:USERPROFILE\Downloads",
"$env:USERPROFILE\Music",
"$env:USERPROFILE\Source",
"C:\ProgramData\MySQL\MySQL Server 8.0.39.0\Data"
)
foreach ($dir in $directories) {
if (-Not (Test-Path -Path $dir)) {
Write-Host "Directory does not exist: $dir"
try {
New-Item -ItemType Directory -Path $dir -Force | Out-Null
Write-Host "Created directory: $dir"
} catch {
Write-Host "Failed to create directory: $dir. Error: $_"
}
} else {
Write-Host "Directory already exists: $dir"
}
}