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 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 this command
Copying Files Using The Tokens / Delims Command
1. Open the command prompt
2. Enter the drive letter you want to go to e.g. C:
3. Enter cd C:\myfolder\path\ – this path needs to be the root directory with all the subdirectories!
4. 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. 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.