首页 > 代码库 > atitit.提升备份文件复制速度(3) ----建立同步删除脚本
atitit.提升备份文件复制速度(3) ----建立同步删除脚本
atitit.提升备份文件复制速度(3) ----建立同步删除脚本
1. 建立同步删除脚本两个方法.. 1
2. 1从回收站info2文件... 1
3. 清理结束在后snap比较 1
4. Npp replace gene del from lst 1
5. Code 2
1. 建立同步删除脚本两个方法..
2. 1从回收站info2文件...
Copy info2
{String s="G:\\RECYCLER\\S-1-5-21-602162358-1284227242-682003330-500\\info2";
core.copy(s, "c:\\info2.txt");
geneDelBatShell >>gene del.bat
3. 清理结束在后snap比较
trave2sqlUtil>>snap.sql
比较 SELECT CONCAT(‘del‘,‘ ‘,‘"‘,file,‘"‘) as t FROM `foldercount` where file not in (select file from foldercountclraftr )
导出lst.txt.bat
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
4. Npp replace gene del from lst
\r\n >>>"\r\n del "
5. Db ddl
CREATE TABLE `foldercount` (
`file` varchar(255) DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`extname` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `i_f` (`file`)
) ENGINE=InnoDB AUTO_INCREMENT=39702 DEFAULT CHARSET=utf8;
CREATE TABLE `foldercountclraftr` (
`file` varchar(255) DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`extname` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `i_f2` (`file`)
) ENGINE=InnoDB AUTO_INCREMENT=51753 DEFAULT CHARSET=utf8;
6. Code
geneDelBatShell
public class geneDelBatShell {
/**
@author attilax 老哇的爪子
\t@since Aug 3, 2014 4:00:19 AM$
* @param args
* @throws IOException
*/@SuppressWarnings("all")
public static void main(String[] args) throws IOException {
// attilax 老哇的爪子 4:00:19 AM Aug 3, 2014
final filex fc = new filex("c:\\infoDelBat.bat");
String s = "c:\\info2.txt";
filex.read_HP(s, "gbk", new Closure() {
@Override
public Object execute(Object arg0) throws Exception {
// attilax 老哇的爪子 4:11:57 AM Aug 3, 2014
{
String line = arg0.toString();
List<String> li = strUtil
.find(regExpress.pathExpress, line);
for (String f : li) {
if(f.length()<9)continue;
String fname=filex.getExtName(f);
if(fname.length()==0)continue;
System.out.println(f);
if(pathx.isFile(f))
fc.append_HP(f + "\r\n");
}
return null;
}
}
});
fc.close();
System.out.println("--f");
}
// attilax 老哇的爪
trave2sqlUtil
private static void trav() throws IOException {
final String fileName = "c:\\clraft.sql";
final CharSequence tab="folderCountClraftr";
final filex fc = new filex(fileName);
dirx.trave("G:\\ati\\doc", new Closure() {
@Override
public Object execute(Object arg0) throws Exception {
// attilax 老哇的爪子 3:46:39 AM Aug 2, 2014
{
String fname = arg0.toString();
String oriname=fname;
fname=fname.replace("‘", "\\‘");
File f = new File(fname);
String sql = "insert @t(file,size,extname)values(‘@f‘,@size,‘@ext‘) "
.replace("@f", fname)
.replace("@size", String.valueOf(f.length()))
.replace("@ext", filex.getExtName(oriname))
.replace("@t",tab);
logger.info(sql);
sql = sql.replace("\\", "\\\\");
sql = sql.replace("\\\\‘", "\\‘");// Coldwine\\‘s Blog - 博客园.htm restore to \‘
fc.append_HP(sql + ";\r\n");
return null;
}
}
});
fc.close();
}