简体   繁体   中英

Moving Files between Servers

I was able to implement moving files from one directory to other in the same system using JAVA URL Connection.But I have to move files from a directory of one server to another(linux or windows) , and I should not use the third party Java APIs. Is there a way how to implement this? If yes , what configuration details are required in the program.please let me know how to implement it.

What about writing a very small script like below..

SOURCEDIR=/home/subodhr/e_books/
DESTDIR=user@server:home/subodhr/Destination/    
rsync -avh --exclude="*.bak" $SOURCEDIR $DESTDIR

save this file using .sh extension like moveFile.sh then execute the script as ./moveFile.sh

Read the contents into serializable objects and pass them across different machines. Once received, just write them to the disk. You should be able to do this using core Java API.

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