You can use the following switches to skip certain files. Or, use a much powerful copy command line alternative instead, i.e. The %~nx in the command is to strip off the folder info from the variable %f so you only get the filename as the result. FOR %f in ('frompath\file\*.*) DO IF NOT EXIST 'topath\%~nxf' COPY 'frompath\file' 'topath\file' If you need to copy a folder to another location but do not overwrite the files already existed in the new location, here is what you can do. echo n | copy /-y 'frompath\file' 'topath\file' IF NOT EXIST 'topath\filename' COPY 'frompath\file' 'topath\file'Ī friend of NoW, Glenn Reimche, shared a much better way using copy command line without the IF statement. You can either use the IF statement to copy the file only when the file does not exist in the destination. Or, if you are using command line copy, you can answer N to bypass these files that are already existed.īut how can I do the same through a batch file using any copy command line?
If you are copying files using drag-drop or copy/paste, you may simply choose “Skip this file” or “Skip these files” option to not overwrite the files that are already existed at the destination folder.