Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (28)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (27)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 4404👍, 0💬
Popular Posts:
What invokes a thread's run() method? After a thread is started, via its start() method of the Threa...
How can we know the number of days between two given dates in PHP? Simple arithmetic: <?php $...
What is the main difference between a Vector and an ArrayList? Java Vector class is internally synch...
Can you explain what is “AutoPostBack” feature in ASP.NET ? If we want the control to automatically ...
How To Create an Array in PL/SQL? - Oracle DBA FAQ - Introduction to PL/SQL If you want create an ar...