hi, i am trying to move a directory from c:\ to d:\. right now i am using this code:
this works fine, as long as i try to move the dir from c:\ to c:\programs or from c:\prgrams to c:\programs\hello. but as soon as i change the partition (c:\ to d:\) success is always false. can you imagine why?
THANKS
Petr Blahos
Ranch Hand
Joined: Apr 28, 2004
Posts: 131
posted
0
Hi Andreas,
you can't rely on that. JavaDoc says:
Whether or not this method can move a file from one filesystem to another is platform-dependent.
That's it. As to your question why: because it is the documented behaviour of the function. I am affraid you will have to copy file by file and then at the end remove the source.
Petr
Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
Max Power
Ranch Hand
Joined: May 10, 2004
Posts: 47
posted
0
hello, oh i see. but what if i do not have the permission to delete the directory after copying it?
thanks :-)
Petr Blahos
Ranch Hand
Joined: Apr 28, 2004
Posts: 131
posted
0
The only thing I can tell you is: It is not trivial to move a directory. Many things can go wrong and this permission to delete is only one of them. You can: - notify user that it was copied but not removed (I think most file managers would do this) - delete what you have copied so far - ask user what to do - ...
P.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.