Hi Dos Gurus,
I need some help to copy a file from indir to archivedir folder.
The directory structure is as follows:
C:\Test\000001\indir
C:\Test\000001\archivedir
C:\Test\000004\indir
C:\Test\000004\archivedir
C:\Test\000011\indir
C:\Test\000011\archivedir
C:\Test\000012\indir
C:\Test\000012\archivedir
C:\Test\000040\indir
C:\Test\000040\archivedir
and so on...
000001, 000004, 0000011, 000012, 000040 etc., are directories each one assigned to one specific user. And these directories can vary in numbers as they may grow in the future.
My requirement is scan through all the indir for *.csv files and copy them to their respective archivedir folder.
Please advise how do I write a program to achieve this and thanks for your valuable time and help.
copy files within multiple directories
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Think this should do it:
Code: Select all
for /d %%a in (c:\test\*) do copy "%%a\indir\*.csv" "%%a\archivedir\"