繁体   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