How to Automatically Move Files From One Folder to Another on Windows 10

  • MORE

You might be moving files regularly from one folder on your laptop to another to archive them, to clean up clutter from your working folders, or as part of a general tidying up at regular intervals. Time is money. If you have a menial job like this that can be automated, it’s always worth the time to spend a few minutes to set up a recurring task that will do it for you.    

You can use a script that uses Robocopy, a command line utility that is included in Windows 10. For the script shared below, you just need to add the frequency in days, path to the folder from where you want to move the files, and the path for the folder you want to move the files to. You can then set up a task in the Task Scheduler to run the script every day at a particular time.  

How to Create a Script to Move Files on Windows 10

1) Type Notepad in the search box on the Toolbar.

search

2) Select Notepad from the search options. 

notepad

3) Type or copy-paste the following script in the Notepad. Replace the number of days, destination folder, and source folder as per your needs. 

@echo off

set X=<days>

set "source=C:\<Source Folder Path>"

set "destination=D:\<Destination Folder Path>"

robocopy "%source%" "%destination%" /mov /minage:%X%

exit /b

type

4) Open the File menu

file

5) Click Save as to save the file.

save

6) Select All files to change the default file type. 

filetype

7) Type <filename>.BAT in the File name field to save the file as a .BAT file. 

name

8) Click Save to save the file. 

save2

How to Create a Task to Run the File

1) Type Task Scheduler in the search box on the Toolbar. 

search

2) Select Task Scheduler from the search options. 

task

3) In the right pane, click Create Task

create

4) Type a name for the task. 

name2

5) Click Triggers to open the Triggers tab. 

triggers

6) Click New to create a Trigger. 

new

7) In the settings, select the frequency to trigger the task. In this example we have selected Daily. 

daily

8) Set up the time when the task will be triggered. 

time

9) Click OK to finalize the trigger settings.   

ok

10) Click Actions to connect an action to the trigger. 

actions

11) Click New on the Actions tab. 

new

12) Click Browse to find the .BAT file previously created. 

browse

13) Click OK to save the new action.

ok2

14) Click X to close the Task Scheduler. 

close