Summary of the invention
The present invention provides a kind of online file synchronisation method in multiple terminals and system, it is possible to increase the reality of multiple terminals on-line synchronous
Shi Xing, solves the problem that multiple terminals file synchronization is made mistakes.
The present invention provides a kind of multiple terminals online file synchronisation method, including:
Obtaining server file list snapshot, described server file list snapshot services at the end of comprising last synchronization
Device listed files information;
Described server file list snapshot and first terminal listed files information are compared, obtains first terminal literary composition
Part list snapshot, described first terminal listed files snapshot comprises described first terminal listed files and updates operation;
Obtaining the second terminal document list snapshot by described server, described second terminal document list snapshot comprises
Two terminal document list update operations;
According to described first terminal listed files snapshot and described second terminal document list snapshot, determine literary composition to be synchronized
Part mark and operation, according to described file identification to be synchronized and operation, described first terminal and described second terminal and described
Server carries out file synchronization.
Meanwhile, the present invention also embodiment also provides for the online file syn chronizing system in a kind of multiple terminals, including at least first terminal,
And with the server of described first terminal communication and the second terminal;
Described first terminal, is used for obtaining server file list snapshot, and described server file list snapshot comprises
One subsynchronous at the end of server file list information;
Described first terminal, is additionally operable to carry out described server file list snapshot and first terminal listed files information
Relatively, obtaining first terminal listed files snapshot, described first terminal listed files snapshot comprises described first terminal file row
Table updates operation;
Described first terminal, is additionally operable to obtain the second terminal document list snapshot by described server, and described second eventually
End listed files snapshot comprises the second terminal document list update operation;
Described first terminal, is further used for according to described first terminal listed files snapshot and described second terminal document
List snapshot, determines file identification to be synchronized and operation, according to described file identification to be synchronized and operation, with described second
Terminal and described server carry out file synchronization.
Meanwhile, the embodiment of the present invention also provides for a kind of server, including:
Listed files snapshot module, is used for storing server file list snapshot, described server file list snapshot bag
Server file list information at the end of synchronizing containing the last time;
Update operation module, for according to first terminal listed files snapshot and the second terminal document list snapshot, determine
After file identification to be synchronized and operation, according to described file identification to be synchronized and operation, with described first terminal and described
Second terminal carries out file synchronization.
Meanwhile, the embodiment of the present invention also provides for a kind of terminal unit, including:
Server file list acquisition module, is used for obtaining server file list snapshot, described server file list
Snapshot comprises server file list information at the end of last synchronization;
Local file comparison module, for comparing described server file list snapshot and local file list information
Relatively, obtaining first terminal listed files snapshot, described first terminal listed files snapshot comprises described first terminal listed files
Update operation;
Far-end File Snapshot acquisition module, for obtaining the second terminal document list snapshot by described server, described
Second terminal document list snapshot comprises the second terminal document list update operation;
File synchronization module, for fast according to described first terminal listed files snapshot and described second terminal document list
According to, determine file identification to be synchronized and operation, according to described file identification to be synchronized and operation, with described second terminal and
Described server carries out file synchronization.
From technique scheme it can be seen that due to the embodiment of the present invention use by server file list snapshot and first
Terminal document list information compares, and obtains first terminal listed files snapshot, and first terminal listed files snapshot comprises institute
State first terminal listed files and update operation;The second terminal document list snapshot, the second terminal document row are obtained by server
Table snapshot comprises the second terminal document list update operation;According to first terminal listed files snapshot and the second terminal document list
Snapshot, determines file identification to be synchronized and operation, according to file identification to be synchronized and operation, first terminal and the second terminal
File synchronization is carried out with described server.Therefore, when effectively prevent online while of first terminal and the second terminal, due to this locality
Listed files difference occurs that file synchronization is made mistakes, also make the online file synchronization in multiple terminals to carry out in real time, it is to avoid user's
Wait, improve Consumer's Experience very well.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Describe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole embodiments wholely.Based on
Embodiment in the present invention, those of ordinary skill in the art obtained under not making creative work premise all other
Embodiment, broadly falls into the scope of protection of the invention.
The embodiment of the present invention provides a kind of multiple terminals online file synchronisation method, it is possible to be prevented effectively from multiple terminals the most online
Time, owing to local file list difference occurs that file synchronization is made mistakes, also make the online file synchronization in multiple terminals to carry out in real time, keep away
Exempt from the wait of user, improve Consumer's Experience very well.The embodiment of the present invention also provides for the online file syn chronizing system in multiple terminals, clothes
Business device and terminal unit.It is described in detail individually below.
Incorporated by reference to referring to Fig. 1, the online file synchronisation method in embodiment of the present invention multiple terminals, comprise the steps:
Step 102, obtains server file list snapshot, and this server file list snapshot comprises last same EOS
Time server file list information.The listed files snapshot of server can comprise file name, document creation and amendment time
Between information, file identification information, the size of file, and last hyposynchronous temporal information etc..
Specifically, server file list information comprises the information of one or more files in listed files.Listed files
Snapshot refers to the map information of some time listed files.Wherein, listed files snapshot comprises listed files information and file status, literary composition
Part state can arrange an original state, in later stage comparison procedure, is used for reflecting the renewal operation of file in listed files, from
And determine the operation of later stage file to be synchronized.
Step 104, compares server file list snapshot and first terminal listed files information, obtains first eventually
End listed files snapshot, first terminal listed files snapshot comprises first terminal listed files and updates operation.
Specifically, first terminal scans local file list information, and server listed files snapshot compares, and obtains
The renewal operation that local file list is complete relative to server file list, this renewal operation refers to relative to server
The renewal operation of listed files snapshot, such as, add, delete and amendment etc..Wherein first terminal listed files snapshot can comprise
All files list information, it is also possible to only comprise the listed files information of renewal part.
Step 106, obtains the second terminal document list snapshot by server, and the second terminal document list snapshot comprises
Two terminal document list update operations, this renewal operation refers to operate, such as relative to the renewal of server file list snapshot
Add, delete and amendment etc..Wherein the second terminal document list snapshot can comprise all files list information, it is also possible to only bag
Containing the listed files information updating part.
Specifically, first terminal sends the second terminal document list snapshot request to server, server according to this request,
Listed files snapshot request is sent to the second terminal.It is fast that second terminal to server returns the second local terminal document list
According to.
Step 108, according to first terminal listed files snapshot and the second terminal document list snapshot, determines literary composition to be synchronized
Part mark and operation, carry out file according to file identification to be synchronized and operation, first terminal and the second terminal and server same
Step.
Specifically, according to first terminal listed files snapshot and the second terminal document list snapshot, the literary composition that need to update is determined
Part list, including file identification and file operation.According to these file identifications and operation, by first terminal and the second terminal
On file and server keep consistent.Such as, there is abc.doc file not exist on first terminal, and belong to the second terminal
The new file of upper establishment, then, after being synchronized on server by abc.doc, be re-synchronised on first terminal.
Preferably, according to first terminal listed files snapshot and the second terminal document list snapshot, literary composition to be synchronized is determined
Part mark and operation, specifically include: compare first terminal listed files operating time and the behaviour of the second terminal document list
Make the time, using the operating time later as file identification to be synchronized and operation.So can avoid file conflict very well, improve
The experience of user, prevents the loss of user's update content.
Preferably, according to first terminal listed files snapshot and the second terminal document list snapshot, literary composition to be synchronized is determined
Part mark and operation, specifically include: merges first terminal listed files snapshot and the second terminal document list snapshot, according to merging
After listed files snapshot, determine file identification to be synchronized and operation.So that user is according to the file after a merging
List snapshot quickly determines the file identification and operation that band synchronizes, and quickly carries out file synchronization.
Preferably, file is carried out according to file identification to be synchronized and operation, first terminal and the second terminal and server
Synchronizing, specifically including: if there being multiple same file, then delete earlier documents and the file identification of redundancy.Can improve well
System, for the disposal ability of file, reduces the garbage files of redundancy, improves Consumer's Experience.
Preferably, before the earlier documents deleting redundancy and file identification, by earlier documents and the file identification of redundancy
Backup on server, when earlier documents and the file identification of the redundancy that needs undelete, utilize and backup on server
Version synchronization to terminal unit to be synchronized.Prevent from during synchronizing, file being deleted by mistake, cause user cannot find it
The file of preamble so that when user can utilize, ray machine function finds the file oneself deleted, comprehensive provides the user
File synchronization and backup.
Server file list snapshot comprises terminal and the last information with EOS hereinafter part list of server, permissible
On the server, first terminal obtains this server file list snapshot from server in storage.It addition, server file list is fast
According to comprising file identification, file path, file creation time, whether be catalogue, or file status, wherein, file identification
Can be filename, it is also possible to be alternative document flag information;File status is used for reflecting for the file in listed files
Update operation.It addition, server file list snapshot can further include version number, this version number mark is last
At the end of synchronization, the version information of listed files under the catalogue to be synchronized of terminal and server.
If it should be noted that first terminal is to run for the first time to synchronize, the most there is not the synchronizing process of last time, then
Not presence server listed files snapshot on server, or, even if presence server listed files snapshot on server, but
Read unsuccessfully, such as lose or damage, be required for server and directly scan file and catalogue under local synchronization catalogue, rebuild
Server file list snapshot.
Such as, the example of a server file list snapshot be given below:
In this example, server file list snapshot comprises a.txt literary composition under A.txt, B.txt, abc catalogue and abc catalogue
The relevant information of part, whether every record includes file identification, file path, file creation time, is catalogue and file shape
Whether state, wherein, be catalogue string, and 0 represents file, and 1 represents catalogue;File status is initially set to initial.
By the above embodiment of the present invention, when effectively prevent online while of first terminal and the second terminal, due to this locality
Listed files difference occurs that file synchronization is made mistakes, also make the online file synchronization in multiple terminals to carry out in real time, it is to avoid user's
Wait, improve Consumer's Experience very well.
Incorporated by reference to referring to Fig. 2, the embodiment of the present invention, a kind of multiple terminals on-line synchronous system 200 includes:
Including at least first terminal 202, and with the server 204 of first terminal communication and the second terminal 206;
First terminal 202, is used for obtaining server 204 listed files snapshot, and server file list snapshot comprises one
Server file list information at the end of subsynchronous.First terminal 202 is by server file list snapshot and first terminal file
List information compares, and obtains first terminal listed files snapshot, and this first terminal listed files snapshot comprises first terminal
Listed files updates operation.First terminal 202 obtains the second terminal document list snapshot, the second terminal literary composition by server 204
Part list snapshot comprises the second terminal document list update operation;First terminal 202 is further according to first terminal listed files
Snapshot and the second terminal document list snapshot, determine file identification to be synchronized and operation, according to file identification to be synchronized and
Operation, carries out file synchronization with the second terminal 206 and server 204.
Specifically, first terminal 202 and the file synchronization of the second terminal 206, can be based on the second terminal 206 first by file
After uploading to server 204, then from server 204, downloaded this document by first terminal 202, to ensure first terminal 202 He
The concordance of the second terminal 206 file.
Incorporated by reference to referring to Fig. 3, server 204 farther includes:
Listed files snapshot module 302, is used for storing server file list snapshot, and server file list snapshot comprises
Server file list information at the end of last synchronization.
Update operation module 304, be used for according to first terminal listed files snapshot and the second terminal document list snapshot, really
After fixed file identification to be synchronized and operation, according to file identification to be synchronized and operation, enter with first terminal and the second terminal
Row file synchronization.
Alternatively, server 204 can also include backup module 306, if for there being multiple same file, then deleting redundancy
Earlier documents and file identification, before deleting the earlier documents of redundancy and file identification, the earlier documents of redundancy is backed up
On server 204, when earlier documents and the file identification of the redundancy that needs undelete, utilize and backup to server 204
On version synchronization to terminal unit to be synchronized.The implication of this same file is that the title of file is identical, file size also phase
With.
Incorporated by reference to referring to Fig. 4, a kind of terminal unit 400, including:
Server file list acquisition module 402, is used for obtaining server file list snapshot, and server file list is fast
According to comprising server file list information at the end of last synchronization;
Local file comparison module 404, for comparing server file list snapshot and local file list information
Relatively, obtaining first terminal listed files snapshot, first terminal listed files snapshot comprises first terminal listed files and updates operation;
Far-end File Snapshot acquisition module 406, for obtaining the second terminal document list snapshot by server, second eventually
End listed files snapshot comprises the second terminal document list update operation;
File synchronization module 408, is used for according to first terminal listed files snapshot and the second terminal document list snapshot, really
Fixed file identification to be synchronized and operation, according to file identification to be synchronized and operation, carry out literary composition with the second terminal and server
Part synchronizes.
Alternatively, terminal unit 400 can also include: notification module 410, for after file synchronization completes, by clothes
Business device sends a notification message to the second terminal, and notification message includes this hyposynchronous file identification and operation.
Incorporated by reference to referring to Fig. 5, the online file synchronisation method in multiple terminals of the embodiment of the present invention comprises the steps:
Step 502, first terminal sends logging request to server.
Specifically, first terminal sends logging request to server, and this logging request comprises ID, wherein, and user
Mark can be user name or password.This logging request can further include the terminal iidentification of whole first terminal, when multiple
When terminal utilizes same user name to log in simultaneously, server can carry out distinguishing terminal according to terminal iidentification.
Step 504, server carries out login authentication to first terminal logging request, verifies that backward first terminal returns checking
Response.
Specifically, after server receives logging request, obtain the ID in logging request, by inquiry number of users
According to storehouse information, the authority of checking ID, and send the result to terminal.Server can also be further to terminal iidentification
Verify, to distinguish different terminals.
Step 506, acquisition request server file list snapshot, this server file list snapshot comprises last synchronization
At the end of server file list information.The listed files snapshot of server can comprise file name, document creation and amendment
Temporal information, file identification information, the size of file, and last hyposynchronous temporal information etc..
Specifically, server file list information comprises the information of one or more files in listed files.Listed files
Snapshot refers to the map information of some time listed files.Wherein, listed files snapshot comprises listed files information and file status, literary composition
Part state can arrange an original state, in later stage comparison procedure, is used for reflecting the renewal operation of listed files crowd's file, from
And determine the operation of later stage file to be synchronized.
Step 508, server returns server file list snapshot, this server file list snapshot bag to first terminal
Server file list information at the end of synchronizing containing the last time.The listed files snapshot of server can comprise file name, literary composition
Part creates and the temporal information of amendment, file identification information, the size of file, and last hyposynchronous temporal information etc..
Specifically, server file list information comprises the information of one or more files in listed files.Listed files
Snapshot refers to the map information of some time listed files.Wherein, listed files snapshot comprises listed files information and file status, literary composition
Part state can arrange an original state, in later stage comparison procedure, is used for reflecting the renewal operation of listed files crowd's file, from
And determine the operation of later stage file to be synchronized.
Step 510, first terminal scanning local file list, by scan file relevant information (such as file identification,
File path, file creation time, whether be catalogue, or file status etc.) and server listed files snapshot in information (ratio
Such as file identification, file path, file creation time, whether be catalogue, or file status etc.) compare, it is judged that when above
Part is relative to the situation of change of corresponding informance in server file list snapshot, and generates the first listed files snapshot, the first literary composition
Part list snapshot can be the first listed files snapshot updated, it is also possible to be a snapshot regenerated.
Preferably, by the renewal operation note file status in the first listed files snapshot of each file, this eight-legged essay
Part state is become renewal operation from initial initial state, updates operation and includes that local interpolation, this locality are deleted or locally modified
Deng.
Step 512, first terminal is to server request the second terminal document list snapshot.
Specifically, first terminal initiates a listed files request obtaining other online terminals to server, and first eventually
End directly can obtain the second online terminal document list snapshot to server, it is also possible to simply non-fixed to server initiation one
To listed files snapshot request, and judged which is had by the online terminal under same account by server, sentence according to log-on message
Disconnected online terminal.
Step 514, server sends listed files snapshot to the second online terminal and obtains request.
Step 516, the second terminal to server returns the second terminal document list snapshot.
Step 518, server returns the second terminal document list snapshot to first terminal.
Step 520, according to first terminal listed files snapshot and the second terminal document list snapshot, determines literary composition to be synchronized
Part mark and operation.
Step 522, carries out file according to file identification to be synchronized and operation, first terminal and the second terminal and server
Synchronize.
Specifically, according to first terminal listed files snapshot and the second terminal document list snapshot, the literary composition that need to update is determined
Part list, including file identification and file operation.According to these file identifications and operation, by first terminal and the second terminal
On file and server keep consistent.Such as, there is abc.doc file not exist on first terminal, and belong to the second terminal
The new file of upper establishment, then, after being synchronized on server by abc.doc, be re-synchronised on first terminal.
It should be noted that the contents such as mutual, the execution process of information between said apparatus and intrasystem each unit, by
In with the inventive method embodiment based on same design, particular content can be found in the narration in the inventive method embodiment, herein
Repeat no more.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can
Completing instructing relevant hardware by program, this program can be stored in a computer-readable recording medium, storage
Medium may include that read only memory (ROM, Read Only Memory), random access memory (RAM, Random
Access Memory), disk or CD etc..
Owing to the embodiment of the present invention uses, server file list snapshot and first terminal listed files information are compared
Relatively, obtaining first terminal listed files snapshot, first terminal listed files snapshot comprises described first terminal listed files and updates
Operation;Obtaining the second terminal document list snapshot by server, the second terminal document list snapshot comprises the second terminal document
List update operates;According to first terminal listed files snapshot and the second terminal document list snapshot, determine file to be synchronized
Mark and operation, carry out file according to file identification to be synchronized and operation, first terminal and the second terminal and described server
Synchronize.Therefore, when effectively prevent online while of first terminal and the second terminal, owing to file occurs in local file list difference
Synchronization makes mistakes, also make the online file synchronization in multiple terminals to carry out in real time, it is to avoid the wait of user, improves user's body very well
Test.
The online file synchronisation method in multiple terminals, system, server and the terminal that are thered is provided the embodiment of the present invention above set
Standby being described in detail, principle and the embodiment of the present invention are set forth by specific case used herein, above
The explanation of embodiment is only intended to help to understand method and the core concept thereof of the present invention;General skill simultaneously for this area
Art personnel, according to the thought of the present invention, the most all will change, in sum, and this
Description should not be construed as limitation of the present invention.