Reputation: 11
i have list of folders
files in all the folder are named in the same way
I want copying them in one folder without losing the order (folder 01(file01-02...) to folder 10)
I didn't find the way to do it with cmd or another way because I want to do it without any software just with windows
Upvotes: 1
Views: 1141
Reputation: 37569
try this:
@ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
SET "startfolder=c:\data"
SET "targetfolder=x:\data"
for /d /r "%startfolder%" %%a in (*) do (
SET "fname=%%~a"
SET "fname=!fname:%startfolder%=!"
ECHO MD "%targetfolder%!fname!\%%~nxa" 2>nul
for %%b in ("%%~fa\*") do ECHO COPY "%%~fb" "%targetfolder%!fname!\%%~nb-new name%%~xb"
)
Look at the output and remove the word echo
before MD
and COPY
if it looks good.
Upvotes: 1