Removing a folder from a directory outsaide the current directory of Matlab?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muhammad Hussain
le 8 Oct 2014
Commenté : Muhammad Hussain
le 8 Oct 2014
Hi, I have made a gui which opens a folder(In that folder there are some more folders in a directory) and it copies the file(.csv) and rename it with (sub)folder name and save it in the main(parent)folder.Now I want to remove the folder,from which I copied my file and save it in MAIN folder.When i use rmdir('pathname','s'),it gives me the following error''??? Error using ==> rmdir \\-----------\data\My Documents\MATLAB\pathname is not a directory.''Because it has added the directory(pathname)in the current directory of matlab.I want to remove the folder whose directory is pathname.Could somebody tell me please how it would work.Thanks
0 commentaires
Réponse acceptée
Guillaume
le 8 Oct 2014
You just need to specify the full path of the folder you want to delete to rmdir. If you supply just the folder name, it assumes that folder is in the current directory. You can use fullfile to build the full path of the folder:
parentfolder = 'C:\somewhere\on\the\drive';
foldername = 'deleteme'
rmdir(fullfile(parentfolder, foldername), 's');
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!