Page 1 of 1

Can I do a autorun command for moving folders

Posted: 13 Apr 2018 13:12
by tweacle
Hi

I think this can be done via auto run but I need to check.

Im trying to set up a auto run task to run every night at 00.05 hrs to move files from "C" drive to "S" drive.

What I need is folders in C:/Downloads that start with the letters BTP I need them moved into S:/BTP DOWNLOADS and folders in C:/Downloads that DO NOT start with the letters BTP I need them moving into S:/DOWNLOADS

Any Ideas?

Re: Can I do a autorun command for moving folders

Posted: 13 Apr 2018 13:35
by Squashman
You have used the term AutoRun in both of your questions on the forum, but in my opinion you are using the wrong terminology. AutoRun used to deal with programs running when you inserted removable media. That functionality was removed from Windows a while ago. So can you explain to us what you mean by AutoRun?

Re: Can I do a autorun command for moving folders

Posted: 13 Apr 2018 14:05
by aGerman
I think in his former thread he really meant some kind of autorun. Here it's rather a sheduled task where he has to setup a scheduled task in the task scheduler :)

Re: Can I do a autorun command for moving folders

Posted: 14 Apr 2018 04:21
by tweacle
Apologies yes im confusing you all by keep saying autorun.

Wha im trying to do is automatically move files from one folder to the other at a certain time. I think you are right in saying task scheduler.

Re: Can I do a autorun command for moving folders

Posted: 14 Apr 2018 04:37
by aGerman
The batch code for your task may look like that:

Code: Select all

@echo off &setlocal DisableDelayedExpansion
for /f "delims=" %%i in ('dir /ad /b "C:\Downloads\BTP*"') do robocopy "C:\Downloads\%%i" "S:\BTP DOWNLOADS\%%i" /s /e /move /r:1 /w:1
for /f "delims=" %%i in ('dir /ad /b "C:\Downloads\*"') do robocopy "C:\Downloads\%%i" "S:\DOWNLOADS\%%i" /s /e /move /r:1 /w:1
Create a new folder C:\scheduled and save the script as move_downloads.bat in this folder.

Maybe someone of the native English can provide the SCHTASKS command line to setup the scheduled task. I remember some settings were language dependent. I always use the wizard rather than the SCHTASKS command ...

Steffen