How to create relative and shorthand file path names

2

2dogs

I know that Office and Windows XP accept many file path naming conventions
other than a full absolute file path such as "C:\program files\microsoft
office\documents\file.doc", and etc. I have seen a variety of shorthand
methods for naming file paths and some that appear to be relative file paths
that reference a child folder, or parent folder, or perhaps no folder at all
if the file being referenced is in the same folder as the application that
uses it. This would seem to be an absolute necessity, for the sake of
portability from one machine to another, where a file that references or is
referenced by another file may be located somewhere other than in its
original location.

Here is an example of what I mean:

I have 2 folders. (not really, but lets pretend OK)
Here are their absolute locations:

Folder 1 is at location C:\2dogs\my documents\folder1
Folder 2 is at location C:\2dogs\my documents\folder1\folder2

I also have 3 files. (not really, but lets pretend again OK)
Here are their absolute path names:

File 1 is C:\2dogs\my documents\folder1\document1.doc
File 2 is C:\2dogs\my documents\folder1\document2.doc
File 3 is C:\2dogs\my documents\folder1\folder2\image.jpg

In File 1 there is a reference to File 2 that is in the same folder. File 1
refers to File 2 by using the absolute path name to File 2. In File 1 there
is also a reference to File 3 that is in a folder that is 1 level farther
down in the directory tree. File 1 refers to File 3 by using the absolute
path name to File 3.

I send the 2 folders (folder1 with folder2 inside it) to Bill (don't worry
about who Bill is because we are still pretending OK). Bill puts the folders
in his personal folder on his D: drive. So now the paths to the folders are:

D:\Bill\Personal Folder\folder1
D:\Bill\Personal Folder\folder1\folder2

When Bill opens the files and tries to use them they will not work because
all the references in those files point to locations that no longer exist.
That is because the references were absolute file paths that pointed to
locations on 2dogs C: drive. Ther must be path naming conventions that
prevent this kind of problem.

Some of the many formats I have seen are things like "document.doc",
"...\filename", ".../../../My%20Documents/My%20Pictures/document.doc",
C:\\document folder\\document.doc. I have no idea what these formats are and
I can't give better examples because I don't know anymore about the subject.
All I know is that they are obviously not classic long form direct path
references.

There are, obviously, many methods for giving references using relative path
names instead of absolute path names and also methods for abbreviating path
names both relative and absolute. I have queried the Microsoft DB for hours
and have found nothing on this subject. When I posed this same question in
the XP forum it was stated that all these shorthand methods are program
dependent and are different in every program; however I suspect they are also
very Operating System dependent as well. If I am writing HTML code it has its
own format for relative adressing but I suspect that if I open any Microsoft
program the techniques are the same and are dependent on how the OS handles
file path names. These techniques must be documented somewhere.
My question is; Where?
 
D

Daiya Mitchell

some that appear to be relative file paths
that reference a child folder, or parent folder, or perhaps no folder at all
if the file being referenced is in the same folder as the application that
uses it.

Doesn't this answer your own question? The advice I have always seen is that
any files you plan on shopping around electronically need to be stored in
the same folder.

DM
 
B

Bob Buckland ?:-\)

Hi 2dogs,

The pathing shorthand goes back to even before MS
started selling DOS.

To refer to a file in the current folder you can lead
with one dot .

For example if Winzip, that Lost-in-space
mentioned is set up to default to .\ then the files
will be in a folder one level (\) below the current
level (.)

To refer to a level one higher than the current one
two dots ..

Three levels up ...
So in your example of

".../../../My%20Documents/My%20Pictures/document.doc",

('normally' references to files on a hard drive use
backslashes C:\ while HTML uses forward slashes
http:/ )

would be a little unlikely on most machines as the
My Documents folder isn't usually 3 levels down, but
can be if it's in a profile.

HTML has used an escape sequence (%) indicator to signify
that the next two digits are the hex code for a specific
'non printing' character that may be misinterpreted.
%20 is hex 20 (ascii 32) - a space.

For fields in Word and other appplications that may use
forward or back slashes as part of the set of option
'switches' (i.e. /q or \q could mean when you (the program)
see a / in the field the next set of characters before
a space are to be read as a switch(command)) a Windows
'escape' code is used so that when you need to have
a slash such as C:\ or File:// you add one extra
slash so that the program is told if the trigger \
is found, and the next character is also a \ then the
command is to 'read that next character (\) as a real
slash and not something to 'perform', so that you
see things like File:/// and C:\\ to mean a real location.

To support the use of 8.3 (name.extension) DOS file names
Windows uses a shorthand of SomeFi~1.doc as short for
Some File with a really long name.doc Where the first 6
characters are preserved and the first instance is ~1, the
next ~2, etc.

This is a brief description for HTML
http://www.med.und.nodak.edu/misc/RELATIVE.HTM

For Windows and for the Universal Naming Convention (UNC)
http://en.wikipedia.org/wiki/Path_(computing)

Then there's the use of redirection and shorthand names
(variables) such as %temp% in Start=>Run that will take
you to your temp folder...

Now, as long as we're pretending :) we could pretend
that the use of absolute and relative file names within
Word created documents and web documents *always* worked
the way you might expect, but that's not actually the case.
There are some 'design features'(?) in Word or buglets that
in some cases will change absolute to relative or vice versa
when a field is updated, or a file opened/saved and it may
be different in different versions of Word.

For example, if you use File=>Save as in Word to save a file
to say the root folder of the C:\ drive and say your file
name is "The quick brown fox.doc", if you type in
quick brown fox
you get
quick brown fox.doc
You get the same name if you type in
C:\quick brown fox
But, if you type in
C:quick brown fox
you'll get
C:quick%20brown%20fox.doc
and it's an intended design feature to support publishing
to web servers and MS Office sharepoint sites.

=====
I know that Office and Windows XP accept many file path naming conventions
other than a full absolute file path such as "C:\program files\microsoft
office\documents\file.doc", and etc. I have seen a variety of shorthand
methods for naming file paths and some that appear to be relative file paths
that reference a child folder, or parent folder, or perhaps no folder at all
if the file being referenced is in the same folder as the application that
uses it. This would seem to be an absolute necessity, for the sake of
portability from one machine to another, where a file that references or is
referenced by another file may be located somewhere other than in its
original location.

Here is an example of what I mean:

I have 2 folders. (not really, but lets pretend OK)
Here are their absolute locations:

Folder 1 is at location C:\2dogs\my documents\folder1
Folder 2 is at location C:\2dogs\my documents\folder1\folder2

I also have 3 files. (not really, but lets pretend again OK)
Here are their absolute path names:

File 1 is C:\2dogs\my documents\folder1\document1.doc
File 2 is C:\2dogs\my documents\folder1\document2.doc
File 3 is C:\2dogs\my documents\folder1\folder2\image.jpg

In File 1 there is a reference to File 2 that is in the same folder. File 1
refers to File 2 by using the absolute path name to File 2. In File 1 there
is also a reference to File 3 that is in a folder that is 1 level farther
down in the directory tree. File 1 refers to File 3 by using the absolute
path name to File 3.

I send the 2 folders (folder1 with folder2 inside it) to Bill (don't worry
about who Bill is because we are still pretending OK). Bill puts the folders
in his personal folder on his D: drive. So now the paths to the folders are:

D:\Bill\Personal Folder\folder1
D:\Bill\Personal Folder\folder1\folder2

When Bill opens the files and tries to use them they will not work because
all the references in those files point to locations that no longer exist.
That is because the references were absolute file paths that pointed to
locations on 2dogs C: drive. Ther must be path naming conventions that
prevent this kind of problem.

Some of the many formats I have seen are things like "document.doc",
"...\filename", ".../../../My%20Documents/My%20Pictures/document.doc",
C:\\document folder\\document.doc. I have no idea what these formats are and
I can't give better examples because I don't know anymore about the subject.
All I know is that they are obviously not classic long form direct path
references.

There are, obviously, many methods for giving references using relative path
names instead of absolute path names and also methods for abbreviating path
names both relative and absolute. I have queried the Microsoft DB for hours
and have found nothing on this subject. When I posed this same question in
the XP forum it was stated that all these shorthand methods are program
dependent and are different in every program; however I suspect they are also
very Operating System dependent as well. If I am writing HTML code it has its
own format for relative adressing but I suspect that if I open any Microsoft
program the techniques are the same and are dependent on how the OS handles
file path names. These techniques must be documented somewhere.
My question is; Where?

--
2dogs in Oregon USA >>
--
Let us know if this helped you,

Bob Buckland ?:)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*

Office 2003 Editions explained
http://www.microsoft.com/uk/office/editions.mspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top