demofun(){ ` do if test -f $file then echo "file: $file" elif test -d $file then echo "path: $file" fi done } path="/home/lwang/Desktop/wujuan" demofun $path
前几天遇到一个需求,将一个10G的文件夹打包压缩,并去除黑名单上的文件. node自带的只能压缩文件.网上看了集中方案要么对大文件操作不行,要么只能直接操作文件夹,无法对文件夹遍历筛选. 后来确定使用先遍历文件夹打包,然后再压缩的方案.然后在找打包模块时发现tar打包时可以直接压缩.试验后确定使用这种方案.本机试验,12G的文件夹,耗时大约18分钟. 代码如下,其中的tar时第三方模块,需要另外安装 npm install tar var fs = require('fs') var p
打开777权限 public class SystemManager extends Activity { public static boolean RootCommand(String command){ Process process = null; DataOutputStream os = null; try{ process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOut