Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Looking for a batch file to run on a windows scheduled task to:

  1. Check a network location for images
  2. If there are pictures to copy, copy them to a local folder
  3. Delete the pictures from the network location

How would I go about doing this?

share|improve this question
Understand what you want to do, but details would be great. Do you control this folder? Are you or someone else placing the pictures in the folder? Are they a specific file type; gif, jpeg, tiff, png, ect? – CharlieRB Dec 5 '11 at 21:26
I control both folders. Someone else is placing the photos in the network location. They are all .jpg 's – nkuebelbeck Dec 5 '11 at 22:36

In powershell, run the following:

$a = get-childItem network_location -recurse -include *.gif,*.jpg

move $a local_location_here

If you want other extensions, just add them to the list.

To create a powershell script, just open a txt file and then save it with a .ps1 extension.

share|improve this answer
Can you run this from task scheduler in windows 2008 server? – nkuebelbeck Dec 5 '11 at 22:36
what is $a suppose to equal? Path to the jpg? never used powershell – nkuebelbeck Dec 5 '11 at 22:40
got this to work. Dumb question, how do I create a powershell script to run? – nkuebelbeck Dec 5 '11 at 22:48
Shouldn't this be "move" in order to meet the third requirement? Or do a delete upon successful completion of the copy? – Paul Dec 5 '11 at 23:03
@nkuebelbeck, see edit, Paul you are correct. – soandos Dec 6 '11 at 1:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.