سؤال

I am trying to copy a folder and paste it in the same directory it was copied from.

For example

C:\Test is the main directory which consists of a folder ACDM, I would like to copy ACDM in the same directory and rename the new folder to ACDM1 which will have all the same files as ACDM has

I would like to do it using command prompt

I tried the following

C:>Xcopy C:\Test C:\Test\ACDM1 /E /U Cannot perform a cyclic copy 0 File(s) copied

which fails, not sure hoe to add REN command with XCOPY command.

Need help ASAP as i would want to create a batch file which will create a copy of an existing folder and rename it according to a name retrieved from a text file..

هل كانت مفيدة؟

المحلول

xcopy "C:\Test\ACDM\*.*" "C:\Test\ACDM1\" /s/h/e/k/f/c

نصائح أخرى

for /f "delims=" %%a in (yourtextfilename) do xcopy "C:\Test\ACDM" "C:\Test\%%a\" /E

as a .bat file line. Directly from the prompt, change each %% to %

I've assumed (for lack of futher information) that your textfile contains just the one line

ACDM1
  • neither do you specify the textfilename tou want to use.
 xcopy C:\Test\ACDM C:\Test\ACDM1\ /E /Q
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top