This article will explain in detail how these functions are used. First, we introduce the listing file features of the Windows system-like dir command in the Python language, and then describe how to test whether a file name corresponds to a standard file, directory, or link, and a way to extract the file size and date. After that, we'll also explain how to delete files and directories, how to copy and delete files, and how to break a complete file pa
The two-level directory format is often encountered in development projects. For example, the article module, product module, many should be based on the two-level classification form. The general solution sorting scheme, whether it is a first-class classification or a multilevel classification, is set by the administrator to manually edit the sorted values of sibling classifications in the background, depending on the size of the value to determine t
1. Statistics The current directory, the number of PHP filesFind " *.php " WC -L2. Count all php file code lines in the current directoryFind " *.php " Xargs WC -LOrWC -l 'find'*.php"tail -n1Command descriptionWC -l 'find'*.php"'Output resultsNumber of Rows | File1./test.php/phpinfo.php.46 Total DosageTail -n1Output the last 1 lines, if the last 2 lines of output can be 1 after n to change to 2Output resul
Default.gif (this image is a template thumbnail) must be a valid template in the directory
Copy CodeThe code is as follows:
function Get_template ()
{
$template = Array ();
$dir = Cms_root. ' /tpl/';
$n = 0;
if (Is_dir ($dir)) {
if ($dh = Opendir ($dir)) {
while (($file = Readdir ($DH))!== false) {
if ($file = = '. ' or $file = = ': ' or $file = = '. SVN ')
{
Continue
}
if (Is_dir ($dir. $file))
{
if (File
This is a good code and speed from the PHP directory traversal code, the need for friends can refer to.
The code is as follows
Copy Code
$path = ' ... ';function Get_filetree ($path) {$tree = Array ();foreach (Glob ($path. ' /* ') as $single) {if
=" Http://s3.51cto.com/wyfs02/M02/57/3D/wKiom1SVfY2ACwdKAAFq50J2GlU329.jpg "title=" Qq20141220214308.png "alt=" Wkiom1svfy2acwdkaafq50j2glu329.jpg "/>Mplayer.go650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/57/3A/wKioL1SVfkTgJCuAAADiAPgUgAo969.jpg "title=" Qq20141220214345.png "alt=" Wkiol1svfktgjcuaaadiapgugao969.jpg "/>10. The article does not give a complete code file directory structure, is
subclasses by where condition, show only categories (level one)$sql = ' Select A.id,a.parentid,a.name,a.sort,count (b.id) as Count from Product_classify as a ';$sql. = ' LEFT join Product_classify as B on b.parentid=a.id where a.parentid=0 ';$sql. = ' GROUP by a.id Order by A.sort ';$query =mysql_query ($sql);if (mysql_num_rows ($query)) {while ($arr =mysql_fetch_array ($query)) {Echo '
';
echo "
$arr [Name] ($arr [count]) ";$sql = "Select A.id,a.name,a.sort from Product_classify as a
This is a creation in
Article, where the information may have evolved or changed.
Program Name
Countline
OS package to get running parameters
Run the time to provide two parameters, one is the directory, one is the extensionSuch as:countline . go
Exit the program without running parameters
iflen(os.Args) != 3 { fmt.Println("countline [Dir] [extention]") return }
How many ' \ n ' files are calculated
funcstringint64, err error) {
Any PHP file, replace the last line with your own directory?phpclass KillBom{public static $m_Ext = [‘txt‘, ‘php‘, ‘js‘, ‘css‘];//检查的扩展名 /*** 传入一个任意文件 ,自动区分定义的扩展名,然后过滤bom* @param string $file* @return boolean*/public static function killBomByFile($file){$ext = pathinfo($file,PATHINFO_EXTENSION);//获取一个文件 的扩展名 if (in_array($ext, self::$m_Ext) and is_file($file))//允许被替换,而且是个文件 (不是目录 ){$content = file_get_contents($file);//取出文件 详情if (substr($content, 0, 3
This article mainly introduces you about how to use a line of code to delete all the files in the directory of the relevant data, the first Glob function is a simple introduction, and then through the PHP sample code to remove the method introduced in very detailed, for PHP interested friends can reference, Let's take a look below.
Objective
Presumably a lot of
This article mainly introduces you about how to use a line of code to delete all the files in the directory, the article first a simple introduction to the Glob function, and then through the sample code to remove the method introduced very detailed, the need for friends can refer to the following to see it together.
Objective
Presumably a lot of people would wr
-commit script automatically updates SVN with the remote machine execution shell script via ssh.Note:@echo off is not a DOS program,But in DOS batches.The dos of that year, all operations are done with keyboard commands,When you have to enter the same command every time,You can save so many commands as a batch,From then on, just run this batch,is equivalent to a few lines, dozens of lines of command.DOS when running batch processing,Each command in the batch is executed sequentially,And will be
IntroductionThis article is actually not the case, because I use C # code to implement a program, and then suddenly found that I was too stupid too naïve, obviously do not need to write programs and write code, the results of their own two live.Let's take a look. Because, my own reason, this function, the very beginning I use incredibly is oneself writes the program to realize, too silly.Reference. Two s
A case of a batch conversion directory of File encoded shell script code.
Requirements Description:As a result of turning Linux from Windows, many original win under the GBK file needs to be converted into UTF8.
The following script only judges that a UTF8 file is converted to a UTF8 file, and that the default UTF8 file is GBK, and if the file type is inconsistent, it needs to be modified.
Example:
The first contact with the Nodejs file system was confused by its asynchronous response, and later found that Nodejs to determine whether the folder exists and create a folder is still synchronized method, but still want to try to use the asynchronous method to implement.
Methods to use:
Fs.exists(path, callback);
Fs.mkdir(path, [mode], callback);
The creation code that implements the folder directory s
First: Rely on 135 ports, using WMI. A script like the one below is the physical directory that gets the shared directory TTT.
Copy Code code as follows:
strpath = "\\192.168.1.55\TTT"
strpath = Replace (strpath, "\ \", "")
Arrpath = Split (strpath, "\")
StrComputer = Arrpath (0)
Strshare = Arrpath (1)
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.