Questions tagged [path]

The general form of a file or directory name that specifies a unique location in a file system. In many Linux and Unix-like OS the PATH (all upper case) variable specifies the directories where executable programs are searched for.

A path represents a unique file system location using the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly a slash /, a backslash \, or a colon :.

A PATH (all upper case, ) in the Linux, UNIX-like operating systems and Windows contains list of directories, where the shell searches through, when a command is executed. The executables are stored in different directories in the OS. On UNIX-like OS the directories are separated by colon, on Windows by semi-colon.

Examples

Simple way to show the $PATH variable is:

echo "$PATH"
printf "%s\n" "$PATH"

A typical PATH looks like:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin

More generally, a path is a sequence of directions that, when followed in order, reach a certain object or location.

In addition to file system paths, there are paths through a tree:

root->left->right->right->left

or, again more generally, a set of attributes on an object.


There might be some other contexts where the term "path" is used to described something non-URI and non-directory related which are not covered by the general description.

One case would be in a context such as in the SCADA software, Ignition, where the term "path" is generally used to refer to tag-path - as Tag is the basic unit in the software, forming a hierarchical system like directory. Typical tag-path in Ignition look like this:

BaseFolder/MyTag

Or, more complexly when tag is not in the BaseFolder but referred from another "Parent" Tag:

BaseFolder/MyAdvanceUDTTag/MyBaseUDTTag/MyTag
19410 questions
672
votes
46 answers

Accessing nested JavaScript objects and arrays by string path

I have a data structure like this : var someObject = { 'part1' : { 'name': 'Part 1', 'size': '20', 'qty' : '50' }, 'part2' : { 'name': 'Part 2', 'size': '15', 'qty' : '60' }, …
Komaruloh
  • 6,841
  • 3
  • 15
  • 7
640
votes
33 answers

How to get the path of a running JAR file?

My code runs inside a JAR file, say foo.jar, and I need to know, in the code, in which folder the running foo.jar is. So, if foo.jar is in C:\FOO\, I want to get that path no matter what my current working directory is.
Thiago Chaves
  • 9,218
  • 5
  • 28
  • 25
637
votes
23 answers

Error "'git' is not recognized as an internal or external command"

I have an installation of Git for Windows, but when I try to use the git command in Command Prompt, I get the following error: 'git' is not recognized as an internal or external command, operable program or batch file. How do I fix this problem?
Jason Kim
  • 18,102
  • 13
  • 66
  • 105
617
votes
3 answers

Find full path of the Python interpreter?

How do I find the full path of the currently running Python interpreter from within the currently executing Python script?
vy32
  • 28,461
  • 37
  • 122
  • 246
582
votes
30 answers

How to remove illegal characters from path and filenames?

I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using System.IO; namespace ConsoleApplication1 { class…
Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199
568
votes
9 answers

Node.js check if path is file or directory

I can't seem to get any search results that explain how to do this. All I want to do is be able to know if a given path is a file or a directory (folder).
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
524
votes
38 answers

How to change the Jupyter start-up folder

I tried following the instructions given on the Jupyter Notebook documentation. Unfortunately, I haven't been able to figure it out. Where exactly is this "start in" field? I've a windows 7 (64 bit) system, with Anaconda3 installed (not in C drive).…
kchak
  • 7,570
  • 4
  • 20
  • 31
507
votes
10 answers

Folder management with r : Check existence of directory and create it if it doesn't exist

I often find myself writing R scripts that generate a lot of output. I find it cleaner to put this output into its own directory(s). What I've written below will check for the existence of a directory and move into it, or create the directory and…
Chase
  • 67,710
  • 18
  • 144
  • 161
506
votes
5 answers

How do I get the path of the Python script I am running in?

Duplicate: In Python, how do I get the path and name of the file that is currently executing? How do I get the path of a the Python script I am running in? I was doing dirname(sys.argv[0]), however on Mac I only get the filename - not the full…
user34537
486
votes
23 answers

Better way to check if a Path is a File or a Directory?

I am processing a TreeView of directories and files. A user can select either a file or a directory and then do something with it. This requires me to have a method which performs different actions based on the user's selection. At the moment I am…
SnAzBaZ
  • 6,389
  • 4
  • 23
  • 22
477
votes
11 answers

C# getting the path of %AppData%

C# 2008 SP1 I am using the code below: dt.ReadXml("%AppData%\\DateLinks.xml"); However, I am getting an exception that points to the location of where my application is running from: Could not find a part of the path …
ant2009
  • 27,094
  • 154
  • 411
  • 609
476
votes
11 answers

Why does the 260 character path length limit exist in Windows?

I have come up against this problem a few times at inopportune moments: Trying to work on open source Java projects with deep paths Storing deep Fitnesse wiki trees in source control An error trying to use Bazaar to import my source control…
Jeffrey Cameron
  • 9,975
  • 10
  • 45
  • 77
472
votes
4 answers

Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\"), Server.MapPath("/"). What is the difference?

Can anyone explain the difference between Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\") and Server.MapPath("/")?
Manu
  • 28,753
  • 28
  • 75
  • 83
466
votes
9 answers

How do browser cookie domains work?

Due to weird domain/subdomain cookie issues that I'm getting, I'd like to know how browsers handle cookies. If they do it in different ways, it would also be nice to know the differences. In other words - when a browser receives a cookie, that…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
452
votes
9 answers

Get file name from absolute path in Nodejs?

How can I get the file name from an absolute path in Nodejs? e.g. "foo.txt" from "/var/www/foo.txt" I know it works with a string operation, like fullpath.replace(/.+\//, ''), but I want to know is there an explicit way, like file.getName() in Java?
fxp
  • 6,792
  • 5
  • 34
  • 45