Copy wild*.tsv files loop subfolders

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
matrixdude
Posts: 1
Joined: 02 Dec 2022 10:48

Copy wild*.tsv files loop subfolders

#1 Post by matrixdude » 02 Dec 2022 10:55

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

jfl
Posts: 226
Joined: 26 Oct 2012 06:40
Location: Saint Hilaire du Touvet, France
Contact:

Re: Copy wild*.tsv files loop subfolders

#2 Post by jfl » 05 Dec 2022 04:12

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.

Post Reply