function pcd {
 
    exist=`p4 -F %depotFile% files "$1"`
 
    path=`p4 -ztag -F %path% where "$1"`
 
    if [ -z "$exist" ]
    then
        dir=$path
    else
        dir=`dirname "$path"`
    fi
 
    cd "$dir"
}