Friday, March 7, 2014

Windows 8 Scheduled Task to Move Files

It's important to try to automate as much as possible in the day to day activities of your IT job or else you risk wasting lots of time in managing the little things of the job. This means you need to write scripts to get things done for you and scheduling these scripts to run as often as needed.

Today I'm going to share a neat little one liner on how to move files around quickly and scheduling the task to run as often as you want to.  Lets say you have a directory called C:\Nightly and you want to be able to move files out of this directory on a daily bases into another directory called C:\Archive. If the files in this directory are rather large you should try to avoid using a copy operation because it will take a long time.This is where the MOVE command really shines as it is an instant operation.

To begin, create a new file called something like movemyfiles.bat and add the following line to it:

move /Y "C:\Nightly\*.*" "C:\Archive\"

This will move everything inside C:\Nightly into C:\Archive. Now open the Task Scheduler and create a New Basic Task. After clicking through the next buttons and when asked What action do you want to perform select Start a Program. Select your movemyfiles.bat file and your all finished scripting this task.




No comments:

Post a Comment