testbackupfile.java
来自「数据采集:该启动器可以由用户发起为一个后台服务」· Java 代码 · 共 32 行
JAVA
32 行
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 + =
减小字号Ctrl + -
显示快捷键?