Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8939423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:49:11+00:00 2026-06-15T10:49:11+00:00

Take the following directory structure: Parent1 Child folder Child Folder 1 Child Folder 2

  • 0

Take the following directory structure:

  • Parent1
    • Child folder
      • Child Folder 1
      • Child Folder 2

The path to Child Folder 2 would be:

Parent/Child folder/Child Folder 2

But, another valid path can also be

Parent/Child folder/Child Folder 1/../Child Folder 2

Is there a way to “Simplify” the path, or convert a path such as:

Parent/Child folder/Child Folder 1/../Child Folder 2

to

Parent/Child folder/Child Folder 2

I was trying to find a way to extract the file name from the handle that opendir($directory) gives you, but I haven’t found a way to do this yet. I’m also pretty sure there must be some terminology or better wording than “simplify”, but I did not know what to search for. “Simplify path” php didn’t help much.

Edit:

I’ve noticed realpath gives me the complete, full path. It does not give you the relative one, as in Parent/Child folder/Child Folder 2, but C:\Path\To\Server\Directory\Parent\Child Folder\Child Folder 2
That’s a bit disappointing, but I can convert it back with some string manipulation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:49:12+00:00Added an answer on June 15, 2026 at 10:49 am

    If the path actually exists, you can use realpath() to resolve relative path portions. It also resolves symbolic links.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take the following method (written in Ruby but this question could be applied to
Take the following code: <abbr title=World Health Organization>WHO</abbr> Can we style an abbr tag's
I am using Apache 2.2 and mod_rewrite. I would like to take the following
Following is the directory structure of my project: expt-main --------- Makefile_main / \ subdir-1
I am investigating ways to take a directory (folder) and derive some form of
I've got the following directory structure in tomcat 6: tomcat |-lib | |- logback-classic.jar
I have the following statement: Directory.GetFiles(filePath, A*.pdf) .Where(file => Regex.IsMatch(Path.GetFileName(file), [Aa][i-lI-L].*)) .Skip((pageNum - 1)
Take the following naive implementation of a nested async loop using the ThreadPool: ThreadPool.SetMaxThreads(10,
Take the following example, I have a class public class SomeItem { public string
Take the following : #include <stdio.h> main() { unsigned long long verybig = 285212672;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.