最近写的几段小工具代码
来源:互联网 发布:mac怎么连接vps 编辑:程序博客网 时间:2024/05/18 06:28
一、bash路径中的space
#!/bin/bashecho `pwd`bakup=$IFSIFS=`echo -en "\n\b"`for i in $(find . -name "Screen*");donew=${i// /_}#echo ${new}new=${new/Screen_Shot_/}echo ${new}mv ${i} ${new}doneIFS=$bakup
二、大量图片切割
#!/bin/bashpath=$(cd "$(dirname "$0")"; pwd)echo ${path}cd ${path}rm _2016*.pngfor i in $(find . -name "*.png");doconvert $i -quality 100 -crop 480x320+88+106 ${i/2016/_2016}done
import java.io.File;public class What {public static String wrap(int value) {String item = String.valueOf(value);int len = 4 - item.length();StringBuffer sb = new StringBuffer();for (int j = 0; j < len; j ++) {sb.append("0");}sb.append(item);return sb.toString();}public static void main(String[] args) {// TODO Auto-generated method stubString strPath = "/Users/max/Images/iPhone4s/";File dir = new File(strPath);if (!dir.exists()) {System.out.println("Error");return;}StringBuffer sb = new StringBuffer();sb.append("#!/bin/bash\n");sb.append("cd ").append(strPath).append("\n");for (int i = 1; i <= 4000; i += 200) {String from = wrap(i);String to = wrap(i + 199);String result = from + "~" + to;//System.out.println(result);String path = strPath + result;File item = new File(path);if (!item.exists()) {item.mkdir();}for (int j = i; j <= i + 199; j ++) {String haha = "IMG_" + wrap(j) + ".png";File f = new File(strPath + haha);if (!f.exists()) {continue;}sb.append("mv ").append("IMG_").append(wrap(j)).append(".png ");sb.append(result).append(File.separator).append("\n");}}System.out.println(sb);IOBridge.write(sb.toString(), new File("/Users/max/Desktop/start"));}}
0 0
- 最近写的几段小工具代码
- VS 生成代码段的小工具
- C++写的小工具
- 最近做的一个小工具
- 最近写的一个mysql读写分离的,python 小工具:angel mysql proxy
- 最近写的一些通过https request获取token的小工具
- 几款常用的小工具
- 早就写过的小工具-注册表
- 汇编写的QQ小工具
- python写的本地搜索小工具
- 自己写的小工具---JarCleaner
- 以前写的几个小工具
- jetty写的一个小工具
- 用MFC写的小工具:ErrorLookupEx
- 写技术文章必备的几个小工具
- 在写JS时的小工具
- 自动检测代码的一个小工具...
- 删除代码行号的小工具
- swift-传值
- Android corners 与 solid
- Android中Touch事件的处理逻辑
- TOEFL一战(2016年1月24日)
- SOLR使用手册之操作collection
- 最近写的几段小工具代码
- 设计模式:中介者模式
- 两个链表的第一个公共结点
- 关于spring切面的一点理解,记录一下
- 机顶盒业务相关
- 高德导航断网后恢复网络不重新规划路径问题及解决方案
- java起线程超级简单例子(咋个办呢 zgbn)
- 开涛的springMVC教程读书笔记
- GSS系列(1)——GSS1&&GSS3