Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Get the Directory Name out of a File Path Name
How To Get the Directory Name out of a File Path Name? - PHP Script Tips - Working with Directoris and Files
✍: FYIcenter.com
If you have the full path name of a file, and want to get the directory name portion of the path name, you can use the dirname() function. It breaks the full path name at the last directory path delimiter (/) or (\), and returns the first portion as the directory name. Here is a PHP script example on how to use dirname():
<?php
$pathName = "/temp/download/todo.txt";
$dirName = dirname($pathName);
print("File full path name: $pathName\n");
print("File directory name: $dirName\n");
print("\n");
?>
This script will print:
File full path name: /temp/download/todo.txt File directory name: /temp/download
2007-04-23, 5311👍, 0💬
Popular Posts:
Does there exist any other function which can be used to convert an integer or a float to a string? ...
What will be printed as the result of the operation below: #define swap(a,b) a=a+b;b=a-b;a=a-b; void...
What is shadowing ? When two elements in a program have same name, one of them can hide and shadow t...
.NET INTERVIEW QUESTIONS - What are Daemon threads and how can a thread be created as Daemon? Daemon...
Which one of the following statements is TRUE in regard to overloading the ++ operator? 1 You cannot...