Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move multiple files from multiple folders to one folder

I am looking for a .bat file that can look inside multiple folders that contain sub-folders that are named the same and move their contents to a specified folder.

Folder Structure:
Main_folder

  1. MainTextures_folder
  2. Props_folder
    --model1_subfolder
    ------Textures_subfolder
    ----------image files
    --model2_subfolder
    -------Textures_subfolder
    ----------image files
    --model3_subfolder
    -------Textures_subfolder
    ----------image files
    --model4_subfolder
    -------Textures_subfolder
    ----------image files

I need all image files moved from their Textures_subfolder to the MainTextures_folder.

Thanks for any help.

like image 739
user2493464 Avatar asked Dec 06 '25 06:12

user2493464


1 Answers

This expects model* folders under the props folder, and that each model* folder has a textures folder. The MainTextures folder is in the Main_folder.

It's untested and should move all files from each textures folder into the MainTextures folder.

@echo off
pushd "Main_folder\Props"
for /f "delims=" %%a in ('dir model* /b /ad') do (
move /-y "%%a\textures\*.*" "..\MainTextures"
)
popd
like image 67
foxidrive Avatar answered Dec 07 '25 21:12

foxidrive



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!