编写了一个遍历一个目录下所有的文件及文件夹,然后计算每个文件的字符和line的小程序,先把程序贴出来. #coding=utf-8 ''' Created on 2014年7月14日 @author: Administrator ''' import os import os.path rootdir =r'c:\python27\jiaoben' filefullnames=[] def traverse(rootdir,filefullnames): for parent,dirnames,…
脚本内容如下: #!/bin/bash function delete_file { days=$[$-] for i in `find $dir -type f -ctime +$days` do rm -rf $i done } while read line do dir=`echo $line |awk '{print $1}'` days=`echo $line |awk '{print $2}'` delete_file $dir $days done < file.txt 其中,函…
代码如下,里面有注释,应该能看懂. function getFile(file_name) local f = assert(io.open(file_name, 'r')) local string = f:read("*all") f:close() return string end function writeFile(file_name,string) local f = assert(io.open(file_name, 'w')) f:write(string) f:cl…
不会读取 影藏文件 main #!/usr/bin/perl use autodie; use utf8; use Encode qw(decode encode); if(@ARGV ne 3){ # 检查参数 $err = <<"err"; The script execution parameters are wrong! ! path, "suffix", "old value/new value" err die $err;…