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();

}

我要啦免费统计
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值