New to coding - Error /.DS_Store (Name is nonexistent or not a directory) on MacBook
Show older comments
Hi all,
I am new to coding with zero prior experience. I have copied an existing code from a PC (expecting it to be plug and play) and it throws up an error saying "x/.DS_Store (Name is nonexistent or not a directory)". I reckon this should be a quick fix for someone who works with Matlab on macs. Please help me to get rid of this problem!
Cheers,
AS
9 Comments
Geoff Hayes
on 24 Jun 2022
@AS - when do you see this error message? Is this when you try to run the code or something else? If something requires this file, then I suppose you could create one. To do this, you can use the terminal application and change directory to your folder x. From there just open the finder as
xxx@MacBook-Pro x % open .
(i.e. write open .) and that should open the Finder and create the .DS_Store folder (or at least it did for me).
AS
on 24 Jun 2022
Geoff Hayes
on 24 Jun 2022
Edited: Geoff Hayes
on 24 Jun 2022
@AS - can you post the full error message? Can you confirm if the file is created in your x folder by (again from the terminal) running the command
xxx@MacBook-Pro x % ls -ag
after you have opened the Finder. When I tried this, the .DS_Store file was created.
AS
on 24 Jun 2022
Geoff Hayes
on 24 Jun 2022
cd(foldername);
what is foldername? Is it a valid path? How is it set? I don't understand why the code would try to change directory to something that is a filename (.DS_Store)...
AS
on 24 Jun 2022
Geoff Hayes
on 24 Jun 2022
@AS - can you show some of the code that is calling cd? I'm just curious why it it doing that. Else, you can add code like @Image Analyst shows below to skip this file (which is specific to Mac and so that may be why you aren't seeing this on the Windows platform).
"cd(foldername);"
Someone wrote slow fragile code that:
- uses CD() when using absolute/relative filenames is more robust and more efficient,
- iterates over everything that DIR() returns, without using a suitable match string or filtering the results (e.g. based on the ISDIR property), i.e. fragile/buggy code (as your experience using it demonstrates).
Basically you should NOT learn from this code.
AS
on 4 Jul 2022
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!