简体   繁体   English

java将文件移动到已安装的samba共享

[英]java move file to mounted samba share

Why can't I move files in java with 为什么我不能使用

source.renameTo(new File(target));

to a samba share mounted to /mnt/foo (cifs mount in /etc/fstab) 到挂载到/ mnt / foo的samba共享(在/ etc / fstab中的CIFS挂载)

I can use mv, cp with that share - it works perfectly. 我可以在共享中使用mv,cp-效果很好。

The java code works on the local drive and is ok but it doesn't work with the mounted samba share. Java代码可在本地驱动器上运行,并且可以,但不适用于已安装的samba共享。

Any idea why? 知道为什么吗? How can I move files with java to a mounted folder? 如何使用Java将文件移动到已安装的文件夹?

(I only get a failed to move file (false) no exception ...) (我只会移动文件失败(错误),没有异常...)

The rename method documents numerous limitations, including the possibility of not being able to move between different file systems. 重命名方法记录了许多限制,包括无法在不同文件系统之间移动的可能性。 It also points to the move method on the (new in java 7) Files utility which should be able to do the job. 它还指向(java 7中的新增功能)Files Utility上的move方法,该方法应该能够完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM