3

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.

Sander Kruis
  • 41
  • 2
  • 6
  • I assume you are using Windows as your OS? What programming languages are available to use? Look at the similar answers: http://stackoverflow.com/questions/760904/how-can-i-monitor-a-windows-directory-for-changes and http://superuser.com/questions/226828/how-to-monitor-a-folder-and-trigger-a-command-line-action-when-a-file-is-created – Alex G Apr 17 '13 at 15:29

1 Answers1

3

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
}
Tim
  • 1,755
  • 2
  • 22
  • 34
  • To start a Powershell script you can store it anywhere, then call it by filename (using a .ps1 extension). You can also use something like the Windows Powershell ISE and hitting "F5". If you want it to run all the time the computer is running, I think it would work to put the script in the Startup folder of your Windows start menu, although I've never tried this. – Tim Feb 12 '13 at 23:12
  • This is just another waste of system resources. Looping sucks. – Alex G Apr 17 '13 at 15:36