1# Show nice ASCII ZHAW logo in Cyan
4 |___ /| | | | /\\ \ / /
5 / / | |__| | / \\ \ /\ / /
6 / / | __ | / /\ \\ \/ \/ /
7 / /__ | | | | / ____ \\ /\ /
8 /_____||_| |_|/_/ \_\\/ \/
10"@ -ForegroundColor Cyan
12# Show Header (Institute, Author, Date) in Yellow
14Institute: Institute of Signal Processing and Wireless Communications
15Author: Simon Moser (moss)
18"@ -ForegroundColor Yellow
20# Inform the user about the script's purpose in Gray
22This script will delete all processed data files in the current folder and its subfolders. Only the files given from ETHZ will remain.
24"@ -ForegroundColor Gray
26# Specify the folder path here
27$folderPath = Get-Location
29# Output the folder path to the user in Green
31The script will delete all processed data files in the following folder:
34"@ -ForegroundColor Green
36# Ask the user for confirmation before proceeding in Red
37$confirmation = Read-Host "Do you wish to proceed? (Y/N)"
38if ($confirmation -ne 'Y') {
39 Write-Host "Operation aborted by the user." -ForegroundColor Red
40 Read-Host "Press Enter to exit..."
44# Deleting all .log files in the specified folder
45Get-ChildItem -Path $folderPath -Filter "*.log" -File | Remove-Item -Force
46# Navigating through each subfolder starting with "SonE_"
47Get-ChildItem -Path $folderPath -Directory | Where-Object { $_.Name -like "SonE_*" } | ForEach-Object {
48 $currentFolder = $_.FullName
50 # Output the currently processed folder in Magenta
51 Write-Host "Processing folder: $currentFolder" -ForegroundColor Magenta
53 # Deleting all .log files in the current subfolder
54 Get-ChildItem -Path $currentFolder -Filter "*.log" -File | Remove-Item -Force
56 # Deleting the 'temp' directories inside
57 Get-ChildItem -Path $currentFolder -Directory | Where-Object { $_.Name -like "temp" } | Remove-Item -Recurse -Force
59 # Deleting all .json files in the current subfolder
60 Get-ChildItem -Path $currentFolder -Filter "*.json" -File | Remove-Item -Force
62 # Deleting all .mat files
63 Get-ChildItem -Path $currentFolder -Filter "*.mat" -File | Remove-Item -Force
65 # Deleting the 'gait_parameters' directories inside
66 Get-ChildItem -Path $currentFolder -Directory | Where-Object { $_.Name -like "gait_parameters" } | Remove-Item -Recurse -Force
69Write-Host "Operation completed successfully." -ForegroundColor Green
70Read-Host "Press Enter to exit..."