📄 testbackupfile.java
字号:
package src.com.tarena.dms.client;import java.io.IOException;import java.text.SimpleDateFormat;import java.util.Date;public class TestBackupFile { //private static String command = "cmd /c move";windows下 private static String command = "mv"; private static String sFile = ""; private static String dPath = "DMS/bin.test/history"; /** * @param args * @throws IOException * @throws InterruptedException */ public static void main(String[] args) throws IOException, InterruptedException { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");//格式化日期 String dStr = sdf.format(new Date()); String dFile = "wtmpx"+dStr; String commandStr = command + " " + sFile + " "+ dPath + dFile; System.out.println(commandStr); Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(commandStr); pr.waitFor(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -