Sunday, 15 January 2012

how to copy files from one directory to other in batch command -



how to copy files from one directory to other in batch command -

i wish re-create file extension .dyn located in each subfolder of main folder(t15_finished). wish re-create respective subfolder @ other location(t15). have created location using xcopy command. here, .dyn file beingness copied in respective subfolder in t15 folder(see below code). now, have file has extension .dynain located in same subfolder .dyn. , .dynain file getting copied don't want. please see next code have created. can tell me whats wrong ?

@echo off xcopy d:\master\springback\cpw\t15_finished d:\master\springback\fresh_springback\cpw\t15 /t xcopy /e d:\master\springback\cpw\t15_finished\*.dyn d:\master\springback\fresh_springback\cpw\t15 pause

short file names. if dir /x in folder containing .dynain file, see 8.3 filename generated file, , have .dyn extension.

if know extensions of conflicting files, can utilize robocopy /xf switch indicate files (*.dynain) exclude, or can generate exclude file utilize xcopy /exclude:file (see xcopy /? explanation)

or, can generate list of files exclude

(for /f "tokens=" %%a in ( 'dir /s /b "d:\master\springback\cpw\t15_finished\*.dyn" ^| findstr /v /i /e /l ".dyn"' ) @echo(%%~nxa)>excludedfiles.txt xcopy /exclude:excludedfiles.txt /e d:\master\springback\cpw\t15_finished\*.dyn d:\master\springback\fresh_springback\cpw\t15

or (as posted foxidrive), re-create , delete non needed files.

batch-file

No comments:

Post a Comment