How to do simple multitasked loop processing over filenames with PowerShell?

Posted by Ville Koskinen on Super User See other posts from Super User or by Ville Koskinen
Published on 2010-04-05T07:03:15Z Indexed on 2010/04/05 7:13 UTC
Read the original article Hit count: 323

I'm batch transcoding some 50 GB of video files on a USB hard disk which is connected to a wlan router. The drive is mapped as a network drive on my Windows 7 laptop.

The speed handicap of the wlan causes some parts of the processing to become unnecessarily slow, so I would like to do the following with PowerShell:

  1. List the names of the files on the network drive to be transcoded
  2. Copy the first file to a temporary folder on my laptop
  3. Simultaneously
    • Transcode the file in the folder
    • Begin copying the next file from the network drive to the temporary folder
  4. After transcoding and copy have both ended,
    • Delete the file which has been transcoded from the temporary folder
    • Begin transcoding next file in the temporary folder
  5. Loop until all files have been processed

How would I be able to do this with PowerShell? The multitasking part is an obstacle for my skill/persistence combination.

© Super User or respective owner

Related posts about powershell

Related posts about multitasking