Is there any shortcut for go back to previous folder?
Afficher commentaires plus anciens
Sometimes I need to navigate among some folders. I need the "go back" in a convenient way, like "cd -". But, this is not supported in Matlab. Is there any way to achieve this? If not, a keyboard shortcut to pop up the recent directory list is OK,too.
Thank you very much.
8 commentaires
John D'Errico
le 23 Mai 2020
You could always write your own version of cd, which could then maintain a stack of recent directories visited. Then it could easily enough support the "cd -" option.
wei zhang
le 25 Mai 2020
per isakson
le 25 Mai 2020
As far as I understand, to ensure the integrity of the list you need to do all changes between folders with your function. To register changes done with the Current Folder window you will need to use Java.
wei zhang
le 26 Mai 2020
per isakson
le 26 Mai 2020
I change the current folder in a number of different ways
- interactively with the Current Folder
- interactively with the context menu of "the file name tab list"; right click on file name and select "Change Current Folder to" the path of the file
- and more seldom with the function, cd
afaik: There is no documented way to detect these interactive changes and update the list. Your function can only keep track of the folders that are set with the function itself.
There are 178 articles tagged with Java at Undocumented Matlab. A few lines of Java in the Matlab code is no big deal - given that you find the lines somewhere.
In the Current Folder window there are a left and a right blue arrow. One way would be to find the code that these arrows invoke.
wei zhang
le 26 Mai 2020
wei zhang
le 26 Mai 2020
per isakson
le 26 Mai 2020
Réponse acceptée
Plus de réponses (1)
soon kiat
le 29 Mai 2020
cd ..
can also help to go back to previous folder
6 commentaires
Walter Roberson
le 6 Fév 2021
No, this goes to the parent folder, not to the previous folder.
cd /Drive/Shared/Trombone/@pingpong
cd /Drive/531623/home06
cd -
The intent of cd - there would be to cd back to /Drive/Shared/Trombone/@pingpong not to /Drive/531623
soon kiat
le 12 Fév 2021
Thanks for pointing this out.
cd /abc/def/ghi/jkl/mno
cd /abc/def/ghi
cd -
%this will go back to previous path which is /abc/def/ghi/jkl/mno
cd /abc/def/ghi/jkl/mno
cd /abc/def/ghi
cd ..
%this will go back to one level up of the current path which is /abc/def
Walter Roberson
le 12 Fév 2021
Except that
cd -
is not supported :(
omid zandi
le 12 Juil 2021
cd .. is exactly what you are looking for. Thanks Soon Kiat.
omid zandi
le 12 Juil 2021
Does anyone have any suggestion about doing the same thing, but this time for going forward in folders ??
Walter Roberson
le 12 Juil 2021
cd does not keep any kind of history. It has no idea that you used to be in a folder inside the current folder and want to go back there.
Catégories
En savoir plus sur Deploy to Java Applications Using MWArray Data API dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
