簡體   English   中英

Java Eclipse路徑文件可執行文件

[英]Java eclipse Path file executable

我正在嘗試制作一個將文件自動從一個文件夾移動到另一個文件夾的exe。我很難編寫代碼來從所需位置抓取文件。 這是我到目前為止的代碼。

public class Transfer {
     Path source = C:\Users\Name\Google Drive;
             Path newdir = C:\Users\Name\Desktop;
             Files.move(source, newdir.resolve(source.getFileName()), REPLACE_EXISTING);
}

如果您有很多文件操作,則可以使用Apache的FileUtils,它非常易於使用: http : //commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils。 html

查看move *方法。

您可以嘗試在文件操作方面使用mkyong.com解決方案: http ://www.mkyong.com/java/how-to-move-file-to-another-directory-in-java/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM