Forums Register Login

Copy/moving a file from one location to Server location.

+Pie Number of slices to send: Send
Hi,

I want to copy/move an Excel file from source location to Server location.
I supposed to do it manually by uploading the file using browse button in Server url.
Can we do it automatically using java code by eliminating this browse mechanism.
Please give me your valuable suggestions on this.

Thanks in advance
VSRK
+Pie Number of slices to send: Send
You could poll a known directory for the Excel files, and transfer them as they appear. There can be issues with synchronization though. For example, your process could see the Excel file and try to start transferring it before it has been fully created, or while its still being edited. One common trick is to write the file with a different name, like .myfile.xls, then rename it to myfile.xls when you're ready for it to transfer. Another trick is to keep a .lock file in the directory, and delete it when all the files in the directory are ready.

This question isn't specifically about I/O streams, so I'm going to move it over to general Java, where you'll probably get a lot more useful suggestions!
+Pie Number of slices to send: Send
In Windows at least, you can't "move" (renameTo()) files across file systems but you can copy them and then delete the original.
+Pie Number of slices to send: Send
 

Carey Brown wrote:In Windows at least, you can't "move" (renameTo()) files across file systems but you can copy them and then delete the original.


Interesting. I've been able to successfully do just that multiple times, even to different physical hard drives or to a Windows share.
permaculture is giving a gift to your future self. After reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1996 times.
Similar Threads
Properties Files and ResourceBundle
Multiple doc upload in single browse click
Copying a file using http
Disable right click, copy & paste option in <html:file>
JSP uploading files & creating new files
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:28:33.