4

Copy batch files from the current directory, excluding

 2 years ago
source link: https://www.codesd.com/item/copy-batch-files-from-the-current-directory-excluding.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy batch files from the current directory, excluding

advertisements

I know i'm missing something really silly but would like some assistance. I want to create a directory and then add contents into it. The actual location as of now are not the real thing.

C:\Location has some files such as text files or docx or anything.

C:\Location\word.docx and C:\Location\text.txt

I have done

MD "C:\Location\NewName"
XCOPY C:\Location C:\Location\NewName /EXCLUDE C:\Location\NewName

I read about exclude and I added that in to avoid the cyclic problem but it still says can not perform cyclic copy. I would like to add the text files and docx files into the NewName folder. What am I missing?


You cannot xcopy a folder when the destination is inside that folder.
That is what is generating the cyclic copy error.

You can xcopy to another location and then move the destination folder to where you need it.

Tags batch-file

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK