How To Guides Org

Quickly Move All Files From Subdirectories To A Specific Path

Computer tasks are often mundane, but with a little knowledge about the command prompt or Powershell you can quickly move files from subdirectories to a specific path.


Moving Files Manually Is A Waste Of Time

Moving files is a common task and it’s quite boring. If you have a lot of subfolders, it would be a waste of time to move them manually, so I suggest you take a look at the following commands.

Copying Files Using The Tokens / Delims Command

1. Step Open the command prompt

2. Step Enter the drive letter you want to go to e.g. C:

3. Step Enter cd C:\myfolder\path\this path needs to be the root directory with all the subdirectories!

4. Step Now simply enter this command

for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "C:\newpath\" /y

REPLACE C:\newpath\ with your own path

5. Step Done! You moved all files from subfolders in C:\myfolder\path\ to C:\newpath\

As you can see, it’s really easy to move files with the command prompt using the tokens command.

If you want to find out more about how this work, I suggest you enter dir /? for a list of the command line switches that are used in this example.