I want to create a batch file which copy the content of folder. How to copy and paste file into folder using batch. Copy specific files into subfolder in batch.
I am trying to copy files from a folder with numerous subfolders to another drive using a batch file. I want to copy files within specific date ranges (ex. I am using this command with Xcopy: xcopy 'C: Users John Pictures.' F: BACKUP Pictures /s /h /i /y It works, but I want to send different groups of files by date to different destination folders. I am having a problem specifying a date range in the command line.
Can this be done with xcopy or robocopy? Does anyone know how to list the date rang in the command? Thankss in advance, John.
This is the batch file i have created which copy the specific folders which I want. I use the specific server folder name of which I want to copy. Please suggest any improvements.
SETLOCAL ensures that any environment variables you set don't affect the calling process's environment. It's like a sandbox for variables, directory changes, and other shell settings.
I usually use @ECHO instead of plain ECHOs so that if the @ECHO OFF is ever temporarily disabled (say, for debugging purposes), the echo statements don't produce needless noise in the output. I also suggest using a loop to repeat the nearly-duplicate statements: @ECHO OFF SETLOCAL:: variables @ECHO This script takes the backup of file SwiftALM Important folders SET /P source=Enter source folder Example D: jboss6.1 server swift: SET /P destination=Enter Destination folder: SET /P folder=Enter Folder name: @ECHO folder=%folder% MKDIR%destination%%folder% SET xcopy=xcopy /E/V/Q/F/H/I FOR /F%%s IN (conf lib deploy deployers) DO ( echo%%s folder will be copied%xcopy%%source%%%s%destination%%folder%%%s IF NOT ERRORLEVEL 1 @ECHO%%s folder has been copied.
) @ECHO Files have been copied. Press enter to proceed.