filetransfer.java
来自「用JSP+ORACLE写的 公司个人信息网络管理系统(JSP).」· Java 代码 · 共 92 行
JAVA
92 行
/*
* Created on 2004-7-5
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package xin;
import java.io.File;
/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class FileTransfer {
/**
*
*/
final static String filePath = oa.main.ParentBean.FilesPath+"email/2004/07";
public FileTransfer() {
super();
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
java.io.File f0 = new java.io.File(filePath);
String[] filenames = f0.list();
for (int i = 0; i < filenames.length; i++) {
String filename = filenames[i];
System.out.print("File: [" + filename);
java.io.File df = new java.io.File(filePath + "/" + filename);
if (df.exists() && df.isFile()) {
//初始化年月
String upmonth = filename.substring(0, 10);
//新建目录
String saveDirectory = oa.main.ParentBean.FilesPath+"email"+"/";
java.io.File f =
new java.io.File(saveDirectory + upmonth.substring(0, 4));
if (!f.exists()) {
f.mkdir();
}
f =
new java.io.File(
saveDirectory
+ upmonth.substring(0, 4)
+ "\\"
+ upmonth.substring(4, 6));
if (!f.exists()) {
f.mkdir();
}
f =
new java.io.File(
saveDirectory
+ upmonth.substring(0, 4)
+ "\\"
+ upmonth.substring(4, 6)
+ "\\"
+ upmonth.substring(6, 8));
if (!f.exists()) {
f.mkdir();
}
String dName =
new String(
saveDirectory
+ upmonth.substring(0, 4)
+ "\\"
+ upmonth.substring(4, 6)
+ "\\"
+ upmonth.substring(6, 8)
+ "\\"
+ filename);
df.renameTo(new java.io.File(dName));
System.out.println("] Move to=> [" + dName + " ]");
} //end if
} //end for
System.out.println("FIN");
} //end main
} //end class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?