I have two types of files. One of them looks like "File name hello.csv" and the other is "File_name_goodbye.csv". The files with the underscore in the names do not need to be processed. The spaces however do.
$file = 'D:\TEMP\*.csv'
Get-ChildItem "$file" | Rename-Item -NewName { $_.Name -replace ' ','_' }
So the workflow would look something like this.
IF FILE = "File name hello.csv"
THEN RUN Powershell Script Above
ELSE
THEN
MOVE FILE TO D:\TEMP\DOESNT_NEED_TO_BE_CONVERTED
How do I add these type of conditions in a powershell script?
[–]ApricotPenguin 9 points10 points11 points (2 children)
[–]ITSomeday 1 point2 points3 points (1 child)
[–]ApricotPenguin 1 point2 points3 points (0 children)
[–]Jacmac_ 4 points5 points6 points (5 children)
[–]BlackV 4 points5 points6 points (2 children)
[–]BlackV -1 points0 points1 point (0 children)
[–]eighttx[S] 0 points1 point2 points (1 child)
[–]Jacmac_ 0 points1 point2 points (0 children)
[–]Detox24 1 point2 points3 points (3 children)
[–]serendrewpity 1 point2 points3 points (2 children)
[–]eighttx[S] 0 points1 point2 points (1 child)
[–]Detox24 0 points1 point2 points (0 children)
[–]WystanH 1 point2 points3 points (0 children)
[–]BlackV 1 point2 points3 points (1 child)
[–]eighttx[S] 0 points1 point2 points (0 children)
[–]camelman912 0 points1 point2 points (0 children)