What will be the relative path from absolute path? - path

Can anyone please tell me what will be the relative path name of C:\\Users\\Kanav Mahajan\\Desktop\\A3 Assignment\\KanavMahajan_200419307.txt of this absolute path ?

The absolute name is
C:\\Users\\Kanav Mahajan\\Desktop\\A3 Assignment\\KanavMahajan_200419307.txt
You are inside the A3 Assignment directory. Therefore, the absolute name of your current directory is
C:\\Users\\Kanav Mahajan\\Desktop\\A3 Assignment
Simply 'substract' one from the other to find the relative path
KanavMahajan_200419307.txt

Sir, relative path means the path relative to a specific folder or a script
so id your script is in
C:\Users\Kanav Mahajan\Desktop\A3 Assignment\
and you want the relative path to the KanavMahajan_200419307.txt file
then , it will be just:
KanavMahajan_200419307.txt

Related

What is called '../' in a relative file/folder path?

In a file path, the set of "words" or folder names required to specify a specific file in a hierarchy of directories is called the path to the file, which is called path name. Path name can be either absolute or relative. In relative form, a sort of patterns like "./", "../", "../../", ... can be used to show the file/folder depth corresponding to the project base folder.
I know what they do or implying by behavior, but what are they called? Do they have a specific name? For example, what is called "../" or "..\" in a file system?
Briefly, it is called levelup notion.
Let's start with defining path:
A path is a slash-separated list of directory names followed by either
a directory name or a file name. A directory is the same as a folder.
Then, we look at types of paths: Absolute and relative paths!
An absolute, or full, path begins with a drive letter, whereas a relative path refers to a location that is relative to a current directory.
In relative paths we may use dot and double-dot symbols. A dot here means the current directory itself. And the double-dot notation, which is called level-up, is used for moving up in the hierarchy.
Now to change the directory using the dot notion we do as follows:
A single dot represents the current directory itself. for example:
in a command line interface (e.g. PowerShell):
cd . will not change the directory as itself point to the current directory.
To change the directory using the level-up notion we do as follows:
each double-dot notions takes you one level up, meaning one folder closer to the base drive or root folder in the hierarchy.
Look at the example below for different cases of using levelup notions:

Is there a name for the dots and forward slashes (i.e. "./", "../", "../../", etc.) at the beginning of relative file paths? What is it?

For clarification, I'm just talking about relative file paths that also include a directory or filename in them, for example ../../some_directory/my_file.ext. I understand that ./ is current directory and ../ is parent directory and that on their own they are in fact relative paths.
But, I am wondering in the context of a relative path that includes directory/directories and possibly the filename and extension after the dots and slashes, what are the dots and slashes known as? The "directory referrer", "path adjuster", etc.?
I'd like to know, because I have a function that creates this portion of the relative path based on target folder's depth (which I am calling frequently throughout my app) and I'd like to give it a name that will help make my code more legible to others. Right now I'm calling them dotSlashes and the function is called prependDotSlashes.
I've googled and stackoverflowed around, but didn't find a definitive name.
If anybody knows the industry-standard name for this portion of relative file paths, I would be curious to know it.
Man, I know the dot as "current directory", and the slashes as directory separator.
The double dots (..) is know as parent directory.
Relative path is a path relative to where you are. Eg: If you are in the /etc path, then, the ./apache path is a relative to that /etc. A full string path (from the root) is named absolute path. So, for example:
../../../../ => Relative path
/home/user/Documents/doc1 => absolute path
./Document/doc1 => relative path from home

cxShellTreeView component get the path

i'm trying to get full path of the selected Folder. Only thing i was able to find is this
cxShellTreeView2.Folders[Index].PathName, but i don't know how to get this Index.
Is it the path of the map?
self.cxShellTreeView2.Path;
or
self.cxShellTreeView2.AbsolutePath;
Description TcxCustomShellTreeView.AbsolutePath
Use the AbsolutePath property to specify the path to the required shell node. Folder path can be specified in two ways:
as a full path, including all sequence of folders, required for accessing the required shell node from the shell root.
Description TcxCustomShellTreeView.Path
Use the Path property to specify the path to the current shell item. Folder path can be specified in two ways:
as a full path, including all sequence of folders, required for accessing the required shell item from the shell root.
The full path of a selected folder is returned by cxShellTreeView1.AbsolutePath.

How do I convert a relative path in Ant to an absolute path?

I would like to convert a relative path to an absolute path.
How is that done?
The location attribute on the property task will convert relative paths to absolute.
<property name="absolute.path" location="${relative.path}"/>

Name of a path containing the complete file name?

For me, a path was always something that "walks the way to something", but without the "something".
Like a chicken following bread crumbs until it hits the target. But the target is not part of the path. That's what I believe.
So, example: C:/foo/bar = the path. C:/foo/bar/something.html = Path and the "Target".
Can someone tell me what are the correct terms here? How do I call such a path with file?
"Full path"?
"Full qualified path"?
"Path with File Name"? (not precise! "Path with File Name and Extension" ... way too long)
Sure there's a special name for this. Want to know! :)
Nice chicken example... I think you mean absolute path
but, It doesn't matter what the path points to, be it a directory, file, device or otherwise
Wikipedia says:
A path, the general form of a filename or of a directory name, specifies a unique location in a file system.
It doesn't even require an extension, as other mechanisms work out the filetype.
/foo/bar/file.txt = Absolute path
/foo/bar = An absolute path to a directory
../foo = A relative path to a directory, from current directory
./file.txt = A relative path to a file, from current directory (Unix)
file.txt = A relative path too
Also
Systems can use either absolute or relative paths. A full path or absolute path is a path that points to the same location on one file system regardless of the working directory or combined paths. It is usually written in reference to a root directory.
The distinction between files and directories isn't catered for with a path. A path is always a path to something, be it a file or a directory:
/a/b/c is the path to c regardless of what type (file, directory, device) the end point is.
Also checkout basenames
basename is a standard UNIX computer program, when basename is given a pathname, it will delete any prefix up to the last slash ('/') character and return the result. basename is described in the Single UNIX Specification and is primarily used in shell scripts.
From LINFO
A path is the address of an object
(i.e., file, directory or link) on a
filesystem.
So, unfortunately, you are looking for a specificity of terms that isn't part of the accepted usage. You'll have to define your own terms.
I beleive it is called "full name" regardless of the "target" type, just because everything in UNIX is a file, including a directory. So if a foo is the target (as you called it), then foo is the name, while C:\Direcotry\foo or /usr/bin/foo is the foo's full name.
i have been thinking about it too lately, because in Everything, the path do not include the "target" itself. but when i search in Wikipedia, it say that the target is included.
in your example, you have implicitly assume that there is "only one" target at the end of the bread crumbs. and someone tell the chicken to follow the bread crumbs and then it can get to the target.
what if there are 2 objects in the end? if someone did not tell which one is the target, e.g. include the target itself in the path, the chicken will never know its target.
you can also think like this: for a path which include the file, the target is not the file, but its content or some other imformation of the file.
back to the file system, assume there is several file in a folder. if file name is not included in its path, then they all have same path and you can not find a specific file through its path alone.

Resources