Answer the question
In order to leave comments, you need to log in
How to copy a file to a subfolder?
@echo off
for /D %%a in ("C:\Users\test\Desktop\karty\201*\01-ANIM*") do xcopy /y /d D:\VYPISY\A23457.pdf "%%a \"
201* means all folders that start with this number. Inside this folder there is a folder 01-ANIM where you need to copy the file. If you remove \01-ANIM*, it works - it will copy to all 201*. Please tell me where is the mistake
Answer the question
In order to leave comments, you need to log in
Inside this folder there is a folder 01-ANIM
*
after 01-ANIM
, if there is only one such folder. *
in the path, not the file name (in the particular case, the directory). for /D %%a in ("C:\Users\test\Desktop\karty\201*") do if exist "%%a\01-ANIM\" xcopy /y /d D:\VYPISY\A23457.pdf "%%a\01-ANIM\"
for /D %%a in ("C:\Users\test\Desktop\karty\201*") do for %%b in ("%%a\01-ANIM*") do xcopy /y /d D:\VYPISY\A23457.pdf "%%b\"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question