I want to check a file exist or not in the folder, if exist it will create a new folder. I tried my code, but Its not working. I can not create a new folder, but I already make sure that I have the file that I check.
$WKFD = "$b-$timestamp"
$Path_2 = "C:\Users\Documents\Convert\$WKFD"
if([System.IO.File]::Exists("$Path_2\t.txt")-ne $true)
{
New-Item -ItemType Directory -Force -Path $Path_2+2
}
New-Itemwith-Forcecreates the folder if it doesn't exists, no need ofifstatement.