fstopzero
fstopzero

Reputation: 1073

Generating a file path

Does anyone know a tool for showing the path from one file to another? Ie, if my css file is in:

/User/foo/bar/source/assets/myscreen 

and my image is in:

/User/foo/bar/gamethings/smallimages

How can I quickly, without having to count the file levels (which is simple, but tedious, and has to be done often), generate the path from the css to the image?

Upvotes: 2

Views: 46

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

First, get realpath(1) from GNU Coreutils. Then:

$ realpath --relative-to=/User/foo/bar/source/assets/myscreen /User/foo/bar/gamethings/smallimages
../../../gamethings/smallimages

Upvotes: 4

Related Questions