MATLAB: Copy a folder into another

copy folder

Hello, new user here.
Very basic question…I want to copy a folder which is on the same level (hence outside) of the current folder and paste it in a subfolder of the current folder. I've tried it and by using the status function the result is "1". So, it was a successful operation. The problem is that the only thing it was coppied were the files inside the copied folder and not the folder and its contents.
How can I do it.
Thanks

Best Answer

copyfile('../../oldDirectoryName','newDirectoryName')
Set the new name to be identical to the old one, if you want to retain the same name.
Use more or fewer sets of '../', depending on the number of levels away it is in the directory structure.