Script: To automatic move files from 1 folder to another

Sander Kruis picture Sander Kruis · Feb 11, 2013 · Viewed 8.2k times · Source

I would like to have a script to monitor a folder and when a .mp3 or .m4a file is added it would be automatic copy it to another folder.

Answer

Tim picture Tim · Feb 11, 2013

This can be done simply with PowerShell. I have assumed that you would like the copied file to be removed from the source directory so that any file in the source directory hasn't been copied yet.

The statement start-sleep -s 30 pauses for 30 seconds.

for (;;) {
    start-sleep -s 30
    move-item c:\source\*.mp3 c:\destination
    move-item c:\source\*.m4a c:\destination
}