> Devo leggere un file e spostarlo in una cartella secondaria dopo di che
> cancellarlo dalla principale.
[quoted text clipped - 8 lines]
> File fp = new File(readFolder + listDir[i]);
> fp.renameTo(new File(writeFolder + listDir[i]));
There may be a few Italian-speakers on this newsgroup - I'm not one of
them! - but most of us use English.
If you know English, you will get more answers if you ask your question
in English.
If you don't know English, I'm pretty sure there is an Italian-language
Java newsgroup that would be more helpful. Of course, if you don't know
English, you'll have trouble understanding my remarks ;-)
--
Rhino
Si señor!
Vurdalak - 28 Jun 2006 09:45 GMT
Sorry...
I must move one file in from a folder... but sometimes i move it but
sometimes i can't do it...
I use RenameTo()...
The problem can be that the file is open or used by another user...
My question is:
Can i close all connection to the my file and move it everytime?
This is my code:
File fp = new File(readFolder + listDir[i]);
fp.renameTo(new File(writeFolder + listDir[i]));
Tanks
Oliver Wong - 28 Jun 2006 21:23 GMT
> Sorry...
>
[quoted text clipped - 11 lines]
> File fp = new File(readFolder + listDir[i]);
> fp.renameTo(new File(writeFolder + listDir[i]));
If the file is opened by another user, you probably can't force a
"disconnection" for those other users without the permission of the OS. As
far as I know, there's no API within Java itself to request that all other
users of a file get disconnected.
The renameTo method returns a boolean, which is true if the renaming
succeeded and false if it did not.
- Oliver