browse /tmp in Finder? [closed] - macos

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I wish to go to a specific folder, and I am trying "the menu Go -> Go to folder and enter the path of the folder " as this thread
(https://apple.stackexchange.com/questions/32377/how-do-i-browse-tmp-in-finder) suggested.
However, cannot find the folder.
The folder I am trying to enter is simply the "tmp" folder from the root folder.
I also tried "browser (chrome, firefox), and in the URL bar file:///tmp/", but it gives a different folder compared to the folder that terminal gives.
Did I missed something ? Thanks
PS: from terminal the folder can be found. I only need to enter the folder from the menu for some reason (I need enter a sub-folder named "tensorflow_logs" which is inside "tmp" folder).

You have 3 ways of getting your job done:
In a terminal, type open /tmp
In the Finder, "Go to folder" -> /tmp
In the folder, from the root of the file system, "Go to folder" -> tmp.
Note the similarity between the "Go to folder" and bash when it comes to resolving absolute and relative paths. For the latter, you have to change the "working directory" before.

In UNIX, and OSX is a UNIX flavor, there are path naming conventions which haven't changed for 40 years.
Terms 'Folder' and 'Directory' are interchangeable in OSX.
File system is like a tree,folders in the path hierarchy are delimited by the / sign (in English: slash)
There are two types of path: relative and absolute
Relative paths, observed from current folder, start with name of the next subfolder, i.e. tmp (no / at the beginning).
Asolute paths, observed from the system root folder always start with /, i.e. (/tmp) in your case.
Therefore, you can reach the desired folder by typing its relative path tmp only if you are already in the root folder. From your home or desktop folder it can't be found. So it's better to use absolute path when trying to reach some of those "system owned" folders.
In OSX, some folders reserved for system functionality are invisible from Finder, in order not to confuse the casual user and keep it fool-proof.

Related

please help me out with mac OS 10.11 terminal commands [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm new to using mac. Could someone please help me out with the terminal commands?
cd to jump into folders right?
i tried this but it isn't working for a folder in my desktop.
Basically, I want to enter a folder on my dekstop and then go to another folder inside that. how do i do it?
The Terminal starts in your HOME folder normally. So, type
ls
to list the files and you will see the same folders and files you see when you go to HOME in the Finder. So, you will see Desktop, so now type
cd Desktop
ls
and you will see all the folders and files on your desktop. If you want to go into one called Freddy Frog now, you will need to put double quotes around it to make sure the space between Freddy and Frog is kept and it doesn't think you want to go to a folder called Freddy then one called Frog. so type
cd "Freddy Frog"
ls
and you can now go to the "Spiders from Mars" directory in there with
cd "Spiders from Mars"
ls
In general, you can just start typing the name of the folder you mean and press TAB and it will guess what you mean. So, if you start a new Terminal and type:
ls
you will see the files in your Home directory. Now type:
cd Desk<TAB>
and it will show you what it guesses you mean. That's called filename completion. If you want to know where you are currently located, use:
pwd
which will print the working directory.
If you want to return to your HOME directory at any time, just type:
cd
Two other tips for you if you are learning your way around...
Firstly, if you want Finder to open and display the directory you are currently in in the Terminal, you can run:
open .
Secondly, when Finder opens, you can turn on the Path bar at the bottom of the window by typing:
Command+Option+P
I have shown it in red - no idea why Apple ships with it turned off by default - probably explains why most Mac users I have met generally have no idea where their files are and don't know the difference between copying and moving files!
To change directory to say /usr , the command should be cd /usr
i.e. cd followed by the absolute path of the directory. For relative paths use cd ./usr where the directory usr is in your current directory.This link gives complete documentation of cd command.
Use the change directory command:
using relative paths cd ./relative/path/to/directory
using absolute paths cd /absolute/path/to/directory
IMPORTANT: do not to forget the space after cd and before the path!!!!!
On Windows, the space isn't needed for some reason...

os.listdir() showing file actually not in the folder on Python and Windows

The following Python script:
import os
print os.listdir('D:\images')
is outputing the names of all the folders in the D:\image directory, but it is also showing desktop.ini in the same folder, while there is no such file in the image directory.
Its also not a hidden item, I am sure of that.
Why is it then showing it as a content?
desktop.ini is a protected system file, and Windows tends to hide it.
You can verify by going to D:\images in a terminal and running dir /A.
See this answer as well.
You can use os.walk() if you want more control, it will give you directories and files separately. You can also use os.path.isdir() to find out if an entry you get is a directory.
I used os.path.isdir(path) to check whether the item returned by os.listdir() is a directory or not
This way,desktop.ini didn't meet the criteria of being a directory and my program scanned all the folders.

Setting a path in OSX for Matlab

I just shifted from a windows machine to a apple machine at work. I have no experience with apple and this is the first time I am using OSX.
I have a matlab script that I have to run on this machine but I cannot seem to get the path to my files.
My files are on a network drive. In windows its as simple as U:\Matlab Now I can access my files in the explorer but cannot seem to set them in Matlab using cd
To get the path of my files I right clicked on the folder and copied the where It provided me with this:
Volumes/home9/MATLAB/
Now to set these paths in Matlab I did this:
cd('Volumes/home9/MATLAB/')
But am provided with the error:
Cannot CD to Volumes/home9/MATLAB/ (Name is nonexistent or not a directory).
As you can tell I have no idea what I am doing. Some guidance would be appreciated.
Thank you
I think you meant to use which, not where. where doesn't exist in MATLAB! Now, your problem is probably due to the fact that you need to prepend your path with /. Therefore, your path should be: /Volumes/home9/MATLAB/. If you don't include the /, it assumes that the directory is local or where MATLAB has currently defined the working directory to be. Judging from the context, you want the absolute path of the directory, and that's why you need the / character as there is a Volumes directory in your root directory.
Try that and see if that works!

rsync with AppleScript, copy from other volume

I'm trying to build a automatic backup solution. My AppleScript commands are pretty simple. All I want to do is copy all the files in one folder to a different folder.
Currently I'm using this:
rsync --update -raz --progress Documents/test "Volumes/RFM_Projects_2"
This works when I have my files located in a folder called test in the Documents folder. Problem is that I have a different folder structure now where I have all the files I want to copy on a second internal harddrive.
I thought it would be easy to just change "Documents/test" to something like "Volumes/WORK/test", but this does not work at all.
Any ideas about how I can change the source location to a secondary harddrive?
All slash-delimited style paths, like the ones used in your rsync command, must start with a slash (/). That slash stands for the startup volume drive. I do not see that first slash in any of your paths so I'm surprised any of your code ever worked. Here's an applescript which will show you the path. Run this, select any folder you want, and copy/paste the result into your code. Note that if there are any spaces in any of your paths then you should put your paths in quotes in your rsync command.
choose folder
return POSIX path of result
Also note if you want the path to a file instead of a folder then change the word folder to file in the applescript. Good luck.

IS there any way to add an alias to the user Documents folder inside a DMG

It is easy enough to add an alias to the Applications folder inside a DMG as it is at /Applications on every Mac. But is it possible to add an alias to a user's Documents folder, where the Documents folder has a different path for each user? I tried adding an alias to ~/Documents, but it became an alias to /Users/andyb/Documents, which obviously won't work on anyone else's machine.
You cannot use a symbolic link to the users Documents directory since you don't know the path. The '~' as an abbreviation to the home directory cannot be used in a symbolic link because there's no shell that would resolve it.
Alias Files can only be created by the Finder (there's no API for that in Mac OS X), so if an Alias File from the Finder is not working, then there's no way.
I'm afraid, the answer is no.

Resources