문제

I have a requirement of copying few files in to a folder. I am not sure what the folder name will be but I am sure that the folder will be ending with -Distribution.

I have written a command:

xcopy D:\config.dat D:\All_Dist\basic_dist\*-distribution\/R

But I am getting an error message as:

File creation error - The filename, directory name, or volume label syntax is incorrect.
도움이 되었습니까?

해결책

for /d /r "D:\All_Dist\basic_dist" %%a in (*-distribution) do (
    copy "d:\config.dat" "%%~fa"
)

Search for the required folder, then copy the file into it.

다른 팁

Since my directories and files are named differently from yours, I tried to match what you are trying to do and I got this to work.

xcopy low\javadeployreg.* \Users\Philip\appData\Local\temp\*-Dist /R/Y

However, if I include the last backslash after the "*-Dist" I get the same error as you but with the added information Unable to create directory - C:\Users\Philip\appData\Local\temp*-Dist so it looks like you just have to remove that last backslash.

the /Y is needed or you will get a prompt for each file you attempt to overwrite a file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top