简体   繁体   中英

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)

I can use mv, cp with that share - it works perfectly.

The java code works on the local drive and is ok but it doesn't work with the mounted samba share.

Any idea why? How can I move files with java to a mounted folder?

(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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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