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 day in d:\download folder and move all arrived pdf files to d:\PDF files\
Thanks a lots for any help
/Soran
#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
2 Replies
Sort By
- Pablo R. OrtizSteel 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 PerotsurCopper ContributorThanks P. R. Ortiz ! It works fine!