문제

I am currently using the following script to copy all files with a certain prefix to a target directory:

for /f "delims==" %%k in ('dir "d:\Search Path\File Prefix*.*" /s /b') do copy "%%k" "d:\Target Directory\"

This works fine but I would like to instead create a symlink to the files incase of any file changes. Please can someone advise how I could do this?

Many Thanks

도움이 되었습니까?

해결책

You utilise the mklink command:

for /f "delims==" %%k in ('dir "d:\Search Path\File Prefix*.*" /s /b') do (
mklink "d:\Target Directory\" "%%~k"
)

And that should solve your problem. mklink /? for more info.

Mona.

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