Function code One: delete all files in directory and directory
Copy CodeThe code is as follows:
Loop Delete directory and file functions
function Deldirandfile ($dirName)
{
if ($handle = Opendir ("$dirName")) {
while (false!== ($item = Readdir
__dir__ : The current content is written in which file to display this file directory__file__ : The current content is written in which file to display this file directory + file nameFor example, the file b.php contains the following
Function code One: delete all files in directory and directory
Copy Code code as follows:
To recycle directory and file functions
function Deldirandfile ($dirName)
{
if ($handle = Opendir ("$dirName")) {
while (false!== ($item
#! /Bin/bashToday = 'date + "% A % B % d "'Yesterday = 'date -- date = "1 day ago"+ "% A % B % d "'Dirname = 'date -- date = "1 day ago" + "% Y % m % d "'Mkdir-P/home/Oracle/ZY/$ dirname
Sed-n"/$ Yesterday/,/$
Removing directories and files with a PHP program has many advantages over FTP removal. First into the FTP is more troublesome, and then delete a large number of files when the FTP deletion is very slow, there is the program just want to delete
The three if sentence is not a reference file? My understanding is to judge there is no, but not a quote!
If it is not a reference, then the methods or settings in these three files are not cited, such as its function or variable constant what is
Using a PHP program to delete directories and files has many advantages over FTP deletion. First into the FTP is more trouble, then delete a large number of files when the FTP deletion is very slow, there is the program just want to delete the files
Share two usage functions: PHP loop Delete directories and directories under the file and only delete files under the specified directory, do not delete the directory folder!Code One: PHP loop delete directories and files under the directoryLoop
Function code: Deletes only the files in the specified directory, and does not delete the directory folder.
The code is as follows
Copy Code
Class Shanchu {All files under the looping directoryfunction Delfileunderdir
Operation of basic files
The basic operation of the file is: file Judgment, catalogue judgment, file size, reading and writing judgment, existence judgment and file time, etc.
';
Return
}/* is a normal file/if (Is_file ($fileName))
This article provides a detailed analysis of the dirname () and _ FILE _ constants in php, for more information, see _ FILE _. the absolute path of the current FILE includes the FILE name, and dirname (_ FILE _) indicates the absolute path of the
* Single-file version of the online Code Editor editor.php version: v1.21* Very easy to edit any text file on your website online, it is very useful for maintaining website and writing code online.* Password encryption Method:* MD5 (password + $ace)/
Password encryption Method:
* MD5 (password + $ace)//$ace for CDN Mirror Address
How to use:
* 1. Confirm that the $PWD variable value is false, upload this file to PHP space and access* 2. First access prompt set password, set password and
deleting files and directories in PHP is actually very simple as long as two functions one is unlink a rmdir function, if you want to implement delete directories and directories under the file we need to use the recursive operation.
Function code:
Method One: First obtain the length of the folder in which the current file is located, and then use substr to intercept the length:
Copy the Code code as follows:
$dirName = str_replace ("\ \", "/", DirName (__file__));$dirNameLength = strlen
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.