in reply to rel2abs doesnot work in unix

for the file '../pictures/logo.gif', it returns the path as /sample/folder1/test/work/../pictures/logo.gif'

That has worked: you have it a relative path (one that depends on which directory you are in) and got back an absolute path (one that, in the case of Unix, starts with a slash and therefore refers to that file regardless of your current directory).

while actually it should be '/sample/folder1/test/pictures/logo.gif'

To clean up a path like that have a look at abs_path and friends in CWD.

Smylers