Forum Discussion

Soran Perotsur's avatar
Soran Perotsur
Copper Contributor
Jan 31, 2018
Solved

Move new arrived files from one folder to an other

Hi I need a poweshell script that move all new arrived pdf files from one folder to an other folder. - New pdf files detaches from email to d:\daownload folder - A scheduled job looks twice a d...
  • Pablo R. Ortiz's avatar
    Jan 31, 2018
    #get all pdf files in "d:\download\ creqated in last 12 hours
    $Files = Get-ChildItem "d:\download\*.pdf" | Where {$_.CreationTime -gt (Get-Date).AddHours(-12)}
    
    #Move files to "D:\PDF files\"
    ForEach ($File in $Files) {
    Move-Item -Path $File.FullName -Destination "D:\PDF files\"
    }

    then create a scheduled task to run the script twice a day

Resources