Path and filename in text format

How do I write the path and filename for a document, spreadsheet, etc. in text format?


When I go to Finder and click on an item whose path and filename I want to capture, I see something like this:

Macintosh HD > Users > myname > Dropbox > Recipes > Blueberry Pie.odf, but I don't think that's the proper way to write this in text format, and I can no longer seem to find a way to copy and paste this.


This is for a command line application, and it needs to be technically correct so that I don't get error messages. When I searched online, all I got was older references telling me ways to obtain and capture this info that no longer work.


Thanks.


High Sierra 10.13.6

Posted on Aug 23, 2018 7:09 AM

Reply

Similar questions

13 replies

Aug 23, 2018 7:18 AM in response to karena13

What command line app? What format does the app need? What you have typed above is the path to the file named. If you are looking to insert the relative path to a file on a web server it would look something like:

myname/Dropbox/Recipes/BlueberyPie.odf. If you were typing the path in terminal it would look something like:

myname/Dropbox/Recipes/Blueberry Pie.odf, It would likely look similar in your app.

Please be more specific about what you are trying to do and with what app.

Aug 23, 2018 7:46 AM in response to BobTheFisherman

"What command line app? What format does the app need?"


Firebird Server 3.0.3 isql

I'm trying to create a new database and I need to tell it the path and filename of the database I want to create.


As far as what format it needs, their instructions simply say to use the path and filename appropriate for your operating system. Their instructions seem to indicate that there is a universal (for each operating system) way to write a path and filename, not one dependent on which app you are using.


"If you were typing the path in terminal it would look something like: myname/Dropbox/Recipes/Blueberry Pie.odf"

When I drag a file such as this to Terminal, I get /Users/myname/Dropbox/Recipes\ Blueberry\ Pie.odf

Not really the same as what you said.

Aug 23, 2018 8:41 AM in response to karena13

You can search as well as I. Everything is explained here: https://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/ht ml/qsg3.html


I included this from the site:

For a Linux server:

servername:/filesystem-path/database-file

Example on a Linux or other Posix server named

serverxyz
:

serverxyz:/opt/interbase/examples/employee.gdb

Which is not for Windows. It is the same format used by your Mac. I did not put any CONNECT statements in my post, you injected those. Your question was about path name format and I responded to that question not a question about CONNECT statements.

Aug 23, 2018 8:26 AM in response to karena13

From the FireBird site: https://www.firebirdsql.org/pdfmanual/html/qsg10-connecting.html


  • For a Linux server:

    servername:/filesystem-path/database-file

    Example on a Linux or other Posix server named

    serverxyz
    :

    serverxyz:/opt/interbase/examples/employee.gdb

  • For a Windows server:

    servername:DriveLetter:\filesystem-path\database-file

    Windows example:

    serverxyz:C:\Pr

Aug 23, 2018 8:27 AM in response to BobTheFisherman

"You can't use a mixture of forward and backward / \ in a path."


I'm not using it, Terminal is.


"What does the app documentation say?"


The Firebird guide doesn't give Mac OS-specific instructions. It simply gives an example of the command you would type on a Windows computer. So I came here to verify how I would replace this with the appropriate Mac path and filename.

Aug 23, 2018 8:31 AM in response to BobTheFisherman

That link is ancient -- Firebird 1.0. I am using Firebird 3.0.3


And you quoted the wrong part, besides. I am using isql:


C:\Program Files\Firebird\bin>isql↵

Use CONNECT or CREATE DATABASE to specify a database

SQL>CONNECT "C:\Program Files\Firebird\examples\employee.gdb"↵

CON>user 'SYSDBA' password 'masterkey';↵


But, again, this is written for a Windows user. I need the appropriate path and filename for Mac.

Aug 23, 2018 11:17 AM in response to karena13

MacOS is a UNIX machine beneath the Finder, and specifically when you are in the Terminal. In UNIX, filenames may not have a space, or certain other reserved characters, and these must be either escaped with an '\', or enclosed in double-quotes. Thus, dragging and dropping a Finder name with spaces such as below, will automatically get escaped in the Terminal:


Finder


All you can eat.txt


Terminal


/Users/username/All\ you\ can\ eat.txt

/Users/username/"All you can eat".txt

"/Users/username/All you can eat.txt"


In Finder, you can option-right-click on a filename, and on the secondary menu, you will see an item, Copy "All you can eat.txt" as Pathname. That will put the UNIX path on the clipboard. In the Terminal, you would enter a double-quote, a command-v to paste the path, and a trailing double-quote. You do this because Apple forgot to escape the white-space in the filename, and it will fail in Terminal without quotation.


This is why I never use white-space, or a dash '-' in a Finder created filename — so I never have to deal with the above issue in the Terminal.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Path and filename in text format

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.