Search code examples
batch-filecmdwindow

Batch command to copy files from source to destination


I need to copy set of files from source to destination, below is the command I am using and its working fine. but folder "29749659" is dynamic and its name always changes. Under "unzipped" only one folder will exist.

xcopy /y C:\Nageswar\unzipped\29749659\files\products\Essbase\EssbaseClient\api\include\* C:\Jenkins\jobs\Planning\branches\develop\workspace\planning\Jni\include

Is there any way to write a command


Solution

  • for /d %%a in (C:\Nageswar\unzipped\*) do xcopy /y "%%a\files\products\Essbase\EssbaseClient\api\include\*" C:\Jenkins\jobs\Planning\branches\develop\workspace\planning\Jni\include
    

    should accomplish this - the for /d scans the target directoryname for directorynames and applies each found in turn to %%a