Home > Blockchain >  Batch - How can I copy files with filetype A from a subfolder A of Path A to subfolder A of Path B?
Batch - How can I copy files with filetype A from a subfolder A of Path A to subfolder A of Path B?

Time:11-10

I am trying to copy all file types that are in different paths with same subfolder names.

Example,

I want to copy from:

C:\PathA\FolderA\file1.filetype1
C:\PathA\FolderB\file2.filetype1
C:\PathA\FolderC\file3.filetype1
.
.
.

into:

C:\PathB\FolderA\file1.filetype1
C:\PathB\FolderB\file2.filetype1
C:\PathB\FolderC\file3.filetype1
.
.
.

How can I do this?

CodePudding user response:

If you want to copy files with specific type only, you can do this:

xcopy (SourceDirectory)\.filetype .\(DestinationDirectory) /S /Y

/S: copies directories and subdirectories (excluding empty), you need to specify this argument to work with subdirectories

/Y: automatically confirm to overwrite existing files in destination directory

You can specify /E instead of /S to copy empty directories.

  • Related