Advertisement
Guest User

Untitled

a guest
Jun 11th, 2020
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. you could do it like this:
  2. -----------------------------
  3. 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
  4. if (does directory already have a directory file?)
  5. else{
  6. create directory file
  7. }
  8. if (is there an entry in source directory file?)
  9. else{
  10. if(is file local?)
  11. {
  12. create hash and add it to the directory
  13. }
  14.  
  15. else{
  16. download
  17. create and add hash
  18. }
  19. }
  20. Upload file
  21. download file
  22. create hash of the downloaded file
  23. if (hash == as in directory file)
  24. else{
  25. jump to file upload. compare again until file == hash or it failed 3 times
  26. }
  27. if (all files uploaded from the directory file?)
  28. {
  29. upload local file with all hash also encrypted and check again, same as above
  30. }
  31. else
  32. {
  33. back to the beginning
  34. }
  35. upload next directory and start again from the top
  36. -----------------------------
  37. example download (examples for cp/sync):
  38. if (is a directory being downloaded?)
  39. {
  40. x=1
  41. }
  42. else
  43. {
  44. x=0
  45. }
  46. if (x=0)
  47. {
  48. download file
  49. hash create
  50. if (hash == as in remote directory file) #download directory file only temporarily to get the hash
  51. else{
  52. jump to file download and compare again until file == hash or it failed 3 times
  53. }
  54. else
  55. {
  56. download directory file
  57. y=0
  58. while (y != z) #z number of files in directory
  59. {
  60. y download #y the file which is currently in the sequence starting with 0
  61. hash create
  62. if (hash == hash from local directory file) #download directory file only temporarily to get the hash
  63. else{
  64. jump to file download and compare again until file == hash or it failed 3 times
  65. }
  66. y += 1
  67. }
  68. if (all files downloaded from the directory?)
  69. {y=0}
  70. else
  71. {
  72. back to the beginning
  73. }
  74. next directory and start from top
  75. }
  76. -----------------------------
  77. 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.
  78.  
  79. my head is throbbing... hope I haven't forgotten anything and no I am not a programmer :D
  80.  
  81. hope I didn't forget anything when yes, than just ask :)
Advertisement
RAW Paste Data Copied
Advertisement