Windows 10

Batch File To Copy All Files From One Folder To Another

In this tutorial, we are going to see how to copy all files from one folder to another. The batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

Syntax
xcopy /s/z c:\source d:\target

Here is some of the options we can find:

  • /s/e – recursive copy.
  • /v – verify the copy versus the original.
  • /h – copy system and hidden files.
  • /k – copy read-only attributes. or else, all files become read-write.
  • /x – if you worry about permissions, you might want /o or /x.
  • /y – don’t prompt before overwriting existing files.
 

Batch File To Copy All Files From One Folder To Another

The following example copy all files from “c:\folder” to “d:\another_folder” using xcopy command:

@echo off

xcopy c:\folder\*.* d:\another_folder\.

Leave a Reply

Your email address will not be published. Required fields are marked *