Click here for important information about

Solved how to move *.mkv in a folder and its subfolder to a special

April 20, 2020 at 05:34:23
Specs: Windows 10
how can I make a batch files to move some MKV files from a folder and its subfolders to a special folder ?
I need a batch file and I want to put it into a folder containing some subfolders then it should do it for me
my English language is not good

See More: how to move *.mkv in a folder and its subfolder to a special

April 20, 2020 at 06:58:39
I would recommend using powershell:

Get-ChildItem -Path "C:\Users\Administrator\Downloads\*" -Include *.mkv -Recurse | Move-Item -Destination "C:\Users\Administrator\Documents" -Force

This will move all .mkv files from the downloads folder to documents folder, change the folder paths as needed.

"Get-ChildItem -Path" gets all the files from the selected folder.
"-Include *.mkv" specify that only .mkv files should be selected.
"-Recurse" makes sure to get the files from sub-folders as well.
It then gets piped out to the "Move-Item" command, with the "-Force" parameter.

Report •

April 20, 2020 at 21:23:25
✔ Best Answer
Well, the short answer for batch:
::--------- begin batch testcop.bat
@echo off & setlocal
:: this is where you want them to go
set dest=c:\dest
for /f "tokens=*" %%a in ('dir /b /s *.mkv') do copy "%%a" "%dest%"
exit /b
::--------- end snippet
This works as long as there are no duplicate filenames in the stream. If there are, or could potentially be, duplicate name, it gets messy - you have to deal with renaming the destination files so as not to overwrite earlier instances of those filenames. Lots of ways to deal with that, but more planning, and coding will be required.

Report •
Related Solutions

Ask Question