-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestructure_simple.ps1
More file actions
32 lines (27 loc) · 959 Bytes
/
restructure_simple.ps1
File metadata and controls
32 lines (27 loc) · 959 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
29
30
31
32
# Simple PowerShell script to restructure AL files
Write-Host "Starting AL file restructuring..."
# Import the mappings
$fileMappings = Import-Csv "file_mapping.csv"
# Rename each file
foreach ($mapping in $fileMappings) {
if (Test-Path $mapping.OldPath) {
Move-Item -Path $mapping.OldPath -Destination $mapping.NewPath -Force
Write-Host "Renamed: $($mapping.OldName) -> $($mapping.NewName)"
}
}
# Remove empty directories
if (Test-Path "src\Pages") {
$pageItems = Get-ChildItem "src\Pages" -ErrorAction SilentlyContinue
if ($pageItems.Count -eq 0) {
Remove-Item "src\Pages" -Force
Write-Host "Removed empty Pages folder"
}
}
if (Test-Path "src\Tables") {
$tableItems = Get-ChildItem "src\Tables" -ErrorAction SilentlyContinue
if ($tableItems.Count -eq 0) {
Remove-Item "src\Tables" -Force
Write-Host "Removed empty Tables folder"
}
}
Write-Host "Restructuring complete!"