user2493464
user2493464

Reputation: 35

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.

Upvotes: 3

Views: 3243

Answers (2)

foxidrive
foxidrive

Reputation: 41234

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

Upvotes: 4

captcha
captcha

Reputation: 3756

for /r "Props_folder" %%x in (*.jpg *.png *.bmp *.whatever) move "%%~fx" "MainTextures_folder"

This code will overwrite all existing files.

Upvotes: 2

Related Questions