Forum Discussion
Soran Perotsur
Jan 31, 2018Copper Contributor
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...
- 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
Pablo R. Ortiz
Jan 31, 2018Iron Contributor
#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
Soran Perotsur
Jan 31, 2018Copper Contributor
Thanks P. R. Ortiz ! It works fine!