Page 1 of 1
Copy wild*.tsv files loop subfolders
Posted: 02 Dec 2022 10:55
by matrixdude
What is the best approach to copy a set of files lets say extension *.tsv from a specified folder to loop through subfolders? Example I want to copy files to all subfolders in a folder named c:\customers\subfoldernames
Re: Copy wild*.tsv files loop subfolders
Posted: 05 Dec 2022 04:12
by jfl
If your goal is to have a copy of the files in each and every subfolder, the command would be:
Code: Select all
for /d %d in (C:\customers\subfoldernames\*) do copy *.tsv "%d"
The for /d option makes it loop on directories.
Then the copy command is repeated for each target directory.