0

The task is to copy files from one directory to another:

Copy-Item $source\*.pdf -Destination $target

The difficulty is that they should be copied sequentially, but each with a Time Offset of 60 seconds. Is there any way I can do this with PowerShell?

I am grateful for any help.
Greetings, Irmi

2
  • You just need a loop and Start-Sleep :) Commented Jun 9, 2021 at 15:19
  • TY. that sounds like a good approach. I'll try :-) Commented Jun 9, 2021 at 15:26

1 Answer 1

1

Use Start-Sleep to wait in between copy operations in a loop:

foreach($file in Get-ChildItem path\to\source\folder -Filter *.pdf){
  # Wait 60s 
  Start-Sleep -Seconds 60
  # Copy file
  $file |Copy-Item -Destination path\to\destination\folder
}
Sign up to request clarification or add additional context in comments.

1 Comment

Perfect! It works like a charme :-) Many thx, Mathias!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.