Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- you could do it like this:
- -----------------------------
- example upload (examples for cp/sync): #did it with if else, because I find it easiest to explain with mount it should be same but adapted
- if (does directory already have a directory file?)
- else{
- create directory file
- }
- if (is there an entry in source directory file?)
- else{
- if(is file local?)
- {
- create hash and add it to the directory
- }
- else{
- download
- create and add hash
- }
- }
- Upload file
- download file
- create hash of the downloaded file
- if (hash == as in directory file)
- else{
- jump to file upload. compare again until file == hash or it failed 3 times
- }
- if (all files uploaded from the directory file?)
- {
- upload local file with all hash also encrypted and check again, same as above
- }
- else
- {
- back to the beginning
- }
- upload next directory and start again from the top
- -----------------------------
- example download (examples for cp/sync):
- if (is a directory being downloaded?)
- {
- x=1
- }
- else
- {
- x=0
- }
- if (x=0)
- {
- download file
- hash create
- if (hash == as in remote directory file) #download directory file only temporarily to get the hash
- else{
- jump to file download and compare again until file == hash or it failed 3 times
- }
- else
- {
- download directory file
- y=0
- while (y != z) #z number of files in directory
- {
- y download #y the file which is currently in the sequence starting with 0
- hash create
- if (hash == hash from local directory file) #download directory file only temporarily to get the hash
- else{
- jump to file download and compare again until file == hash or it failed 3 times
- }
- y += 1
- }
- if (all files downloaded from the directory?)
- {y=0}
- else
- {
- back to the beginning
- }
- next directory and start from top
- }
- -----------------------------
- the directory file could then be written as a hidden file so that it is synchronized with, but has a unique name and is not easily visible. but so that it can be found.
- my head is throbbing... hope I haven't forgotten anything and no I am not a programmer :D
- hope I didn't forget anything when yes, than just ask :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement