I am getting all wav files in the past 24 hours from one folder and putting them in another folder. I swear this worked for me a bit ago and wanted to add in some more conditional statements but now it is working. It is not creating a new folder for 'NewSounds' it is just creating a blank document named that, and I am stumped. Also any tips on best place to put a pipeline for only selecting the -Top 10 results once filtered down from the .wav files recently added??
$scriptPath = "/Users/robertunderwood/Splice/sounds/"
$Destination = "/Users/robertunderwood/NewSounds"
$fileNames = Get-ChildItem -Path $scriptPath -Recurse -Include *.wav
foreach($file in $fileNames){
if ($file.LastWriteTime -ge (Get-Date).AddDays(-1)){
Write-Host $file.Name
Copy-Item $file -Destination $Destination
}
}