Effacer les filtres
Effacer les filtres

Creating folders outside of the current folder

99 vues (au cours des 30 derniers jours)
Chinwe Orie
Chinwe Orie le 2 Mai 2019
Modifié(e) : Stephen23 le 21 Déc 2021
Hi!
I would like to use MATLAB to create folders in a specified folder. However, I've only been able to get MATLAB to create folder within the current folder (cd) using the 'mkdir' command. Is it possible for it to create folders outside of the current one if it is told where to create it?
Thank you!

Réponse acceptée

Stephen23
Stephen23 le 2 Mai 2019
Modifié(e) : Stephen23 le 2 Mai 2019
Of course, just define the parentFolder, or use a relative/absolute path:
I also recommend using function syntax:
Putting it all together:
mkdir(ParentFolder,NewSubFolder)
mkdir(fullfile(ParentFolder,NewSubFolder))
  5 commentaires
Cory Dinkle
Cory Dinkle le 21 Déc 2021
How could I go about creating a folder outside of the current folder without specifiying the parent folder name?
Stephen23
Stephen23 le 21 Déc 2021
Modifié(e) : Stephen23 le 21 Déc 2021
"How could I go about creating a folder outside of the current folder without specifiying the parent folder name?"
Creating a folder requires telling the OS where to create that folder: this may be implicit (e.g. in the current directory) or explicit using a relative/absolute filepath. Perhaps a relative path does what you want.
@Cory Dinkle: please give an example of the path information you have, and the folder that you expect that information to create.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by