The directory structure is as follows:
~
│
--src
│ t test.txt
│ t test02.txt
│ │
│ --save01
│ t tmp.csv
│ │
│ s-save02
--target
│
--save01
s-save02
Now we used the following command to copy the text file from the src directory to the target directory:
xcopy src\*.txt target/s/y
This will remove the save01 directory from the target directory.
I know that if I remove the /s option, it won't be deleted, and I understand that the copy command, not xcopy, is sufficient in the first place, but I don't know why the save01 directory is deleted, so I'm worried.Please let me know.
I will reproduce it with the xcopy command in Windows 7/Windows Server 2012.
In this case, the implementation of xcopy "/S" appears to be flawed.
I can't see the sauce, so it's just my imagination, but I guess it's like this.
·Copy only the directory tree ("/S" specified, excluding empty directories)
·Copy the matching files in the copied directory tree
"·""/S"" is specified, so delete the directory tree that you copied with an empty destination directory
There was a case like this.It's a little different from this one.
© 2024 OneMinuteCode. All rights reserved.