Reputation: 13308
I want to remove all directory content (subdirectories and files, but not the main directory). After that I want to copy all content from other directory to that directory. How could I do this?
This code doesn't work
cd C:\directory1
rmdir /s/q
pause
xcopy C:\directory2\directory22 C:\directory1 /s /e
Upvotes: 1
Views: 296
Reputation: 15232
rmdir needs a directory to delete, so this will work, but you will get an error message:
cd C:\directory1
rmdir . /s /q
pause
xcopy C:\directory2\directory22 C:\directory1 /s /e
But you can also do this:
cd C:\
rmdir C:\directory1 /s /q
md C:\directory1
pause
xcopy C:\directory2\directory22 C:\directory1 /s /e
Upvotes: 2