Relative Paths './' and '../'

  • -->gm<--
  • Student
  • Student
  • User avatar
  • Posts: 68

Post 3+ Months Ago

Hi everyone,

When using relative? paths does anyone know the difference between './' and '../' ?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6243
  • Loc: Seattle, WA

Post 3+ Months Ago

. refers to the directory you're currently in
.. refers to the directory above the one you're currently in
  • -->gm<--
  • Student
  • Student
  • User avatar
  • Posts: 68

Post 3+ Months Ago

Thanks Spork,

Say in this example there isn't any difference between them?

If the webpage is in the root and the images are in an 'image' directory in the root.

Code: [ Select ]
<img src="images/icon_link.png" alt="" width="22" height="22" />
and
<img src="./images/icon_link.png" alt="" width="22" height="22" />
  1. <img src="images/icon_link.png" alt="" width="22" height="22" />
  2. and
  3. <img src="./images/icon_link.png" alt="" width="22" height="22" />


Why would you bother using './'?, for include files or something?

Thanks
  • -->gm<--
  • Student
  • Student
  • User avatar
  • Posts: 68

Post 3+ Months Ago

I can't find a good use for './' in included files either?
Can anyone enlighten me as to when they would use './' ?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Maybe just an operating system relic from before there were browsers ?
  • -->gm<--
  • Student
  • Student
  • User avatar
  • Posts: 68

Post 3+ Months Ago

Maybe, I don't really see a use for it..
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6243
  • Loc: Seattle, WA

Post 3+ Months Ago

In older shells for UNIX/Linux systems, the dot was sometimes required in order to execute a script in the current directory. It really has no use in modern shells and is virtually unnecessary in URLs.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

-->gm<-- wrote:
Maybe, I don't really see a use for it..

I doub't you need to worry about that thing anymore. It's gotten more modern now :D
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

I still use that sometimes with my .net apps actually ... very rarely though ... something like
Code: [ Select ]
Server.MapPath("./")

gives me the current directory on my host ... so if I want to create folders on my root I'll use it like
Code: [ Select ]
Server.MapPath("./" & FolderName)

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 38 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.