How to use robocopy in matlab ?

조회 수: 7 (최근 30일)
houssem gara
houssem gara 2019년 2월 21일
댓글: houssem gara 2019년 2월 22일
Hello,
I have 2 path strings in matlab:
source="C:\2018\c\EM"
destination="U:\Probe\EM"
and i want to use them as arguments for robocopy
when i write system('robocopy source destination') it doesen't work like I want.
robocopy doesn't read the content of source and destination.
Can you help me with this function. Thank you

답변 (2개)

Steven Lord
Steven Lord 2019년 2월 21일
Build the command from the text data then pass the constructed command into system.
source="C:\2018\c\EM"
destination="U:\Probe\EM"
command = "robocopy " + source + " " + destination
system(command)
You may need to add single quotes around the source and destination locations if they contain spaces. Add those quotes inside the strings "robocopy " and " ".
  댓글 수: 1
houssem gara
houssem gara 2019년 2월 22일
Thank you so much :)

댓글을 달려면 로그인하십시오.


houssem gara
houssem gara 2019년 2월 22일
Hello, I have another question. I used robocopy to copy the content of a folder A. the folder A contains a subfolder B and another files. But when I used robocopy it just copy the files in the folder A and it doesn't copy the subfolder B.
THank you
  댓글 수: 2
Steven Lord
Steven Lord 2019년 2월 22일
I've never used robocopy so I'm not sure how (or if) you can get it to work recursively. You're probably going to need to read through its help / documentation, ask the author, or post on a forum for that software.
houssem gara
houssem gara 2019년 2월 22일
okey thank you for your help

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Filename Construction에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by