`
137459045
  • 浏览: 22447 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Linux命令

 
阅读更多
用java重命名文件名
String[] cmd = new String[] { "sh", "-c", "mv /home/wangsaiqi/PcapFile/SrvCategory/SubCategory/App_1.1" +
"  /home/wangsaiqi/PcapFile/SrvCategory/SubCategory/App_3.0" };
Process ps = Runtime.getRuntime().exec(cmd);

移动文件
String[] cmd = new String[] { "sh", "-c", "mv /home/wangsaiqi/PcapFile/SrvCategory/SubCategory/App_1.1" +
"  /home/wangsaiqi/PcapFile/SrvCategory/SubCategory" };
Process ps = Runtime.getRuntime().exec(cmd);
分享到:
评论
1 楼 137459045 2012-05-18  
从地址栏传输中文到后台,
1.地址栏的中文首先需要转换成UTF-8 
String fileName = java.net.URLEncoder.encode(fileNames[i].trim(), "utf-8");
"url?name="+fileName
2.在后台转换成 String tmpFileName = new String(name.getBytes("ISO8859-1"),"UTF-8");


// 转码
String str = "今天";
System.out.println(URLEncoder.encode(str, "UTF-8"));

// 解码
str = "%E4%BB%8A%E5%A4%A9";
System.out.println(URLDecoder.decode("%E4%B8%AD%E6%96%87", "UTF-8"));

相关推荐

Global site tag (gtag.js) - Google Analytics