A
A
andrey_artphoto2020-02-22 21:07:31
cmd/bat
andrey_artphoto, 2020-02-22 21:07:31

How to copy folders to an unconditional path using a bat file?

There is such a folder structure.
5e516bea21aeb103609632.png
And you need to copy each res folder with all its contents (folders, subfolders and files) into the nightmode folders located next to them. Those. there is a res folder in the com.miui.cloudservice folder, then copy it to com.miui.cloudservice\nightmode. Found the res folder. Copied its contents. Created a nightmode folder next to it. Pasted the contents of the res folder into it. Found the following res folder - repeated the steps.
The Bat file is planned to be transferred and run in the Russsia, Moldova, etc. folders. How to write such a bat file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-02-23
@wisgest

Approximately so

for /r "d:\каталог\для\обработки" %%I in (res) do  if exist "%%I\"  xcopy "%%I" "%%I\..\nightmode\" /s

A
andrey_artphoto, 2020-02-23
@andrey_artphoto

It didn't quite work that way. I didn't describe correctly at first. You need to copy not just the contents of the res folder, but the res folder itself. Those. the final path should be \nightmode\res\subdirectory\files , but now it turned out only \nightmode\subdirectory\files without the res folder.
Went through the crutch. I added the res1 folder after the nightmode folder, and then massively renamed all res1 to res through the totalcommander.

@ECHO OFF
::
for /r "d:\каталог\для\обработки" %%I in (res) do  if exist "%%I\"  xcopy "%%I" "%%I\..\nightmode\res1\" /s

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question