I would need help to write a powershell script that checks if there is a folder with the same name as the current date (ddmmyyyy). The script would run every day and copy all files from that folder into another overwriting everything.
I have searched in google but could find no examples
I expect the script to check the subfolders of the current folder and select the one that has the same name as the current date, than go in that folder and copy the files to another location.
here is a basic script that checks if the folder with the current date exists.
$folderPath = "c:\myRootFolder"
$date = Get-Date
$dateString = $date.ToString("yyyyMMdd")
$doesexist = Test-Path ($folderPath + "\" + $dateString)
if($doesexist){
Write-Host "folder does Exist"
}else{
Write-Host "Folder does not exits"
}