1

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?

2
  • 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, 2011 at 21:26
  • I control both folders. Someone else is placing the photos in the network location. They are all .jpg 's Dec 5, 2011 at 22:36

1 Answer 1

2

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.

6
  • Can you run this from task scheduler in windows 2008 server? Dec 5, 2011 at 22:36
  • what is $a suppose to equal? Path to the jpg? never used powershell Dec 5, 2011 at 22:40
  • got this to work. Dumb question, how do I create a powershell script to run? Dec 5, 2011 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, 2011 at 23:03
  • @nkuebelbeck, see edit, Paul you are correct.
    – soandos
    Dec 6, 2011 at 1:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .