From: John Gilmore <sun!gnu at berkeley> In 4.2BSD, the library routine "getwd" does this, without any hokum with pipes. It's probably portable to older systems if you have the directory compatability package (readdir, opendir, etc) which has been posted to net.sources several times.