flat assembler
Message board for the users of flat assembler.

Index > Heap > what are the program you use to sync between dir / drive

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 8903
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
platform os : windows 10

any proven program that you all been using for years,

sync between dirs / drive at scheduled time,
Post 25 Nov 2018, 13:56
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 706
Location: Belarus
DimonSoft
I guess, a plain BAT-file could be written and made scheduled if you only need to ensure the directory is being backed up.

In other cases I doubt it can result in anything good since it brings a lot of questions even at the first glance. What if the same file in two directories has been changed separately? Which one wins? What if a file is present in only one of the directories? Should the deletion or the file itself be propagated?

There are quite good tools for comparing directories though. But the decisions are made by users.
Post 25 Nov 2018, 21:27
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8903
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
the idea is doing some sort of logged based back up that probably enable me to capture what files or directories are being modified by the end of the day,

i could see that the mirror functionality in windows certainly adds up more disk in/out that idk what the hell they are doing all the time even without write event, zero write event but the mirror will just io the whole time, basically i don't trust the implementation,

there are 2 disk drive,
let say, E:\network-shared
and F:\network-shared

byt the end of the day, i would want to synchronize the whole E:\network-shared to their F:\network-shared,

source is E and destination is F

if there are deletion of files and directory, or modified, the idea is as below,

apple.doc will sync to f:\apple.doc , but the previous apple.doc will rename to apple._20181125_0930.doc

so when i need to capture the whole up to date document, i just skip restoring the *._*_*.*

then i could get a let say report by the end of execution, email to whoever concern, probably some statistic stuffs, graph to see who did what and when, and probably file changes statistic some sort,

deletion of file would mean the file will get renamed into some sort of above pattern, so it makes restoration is possible if somehow user accidentally require that file back,

the E would only sync to F by the end of the day, after working hours.
Post 25 Nov 2018, 22:12
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 706
Location: Belarus
DimonSoft
Some sort of version control system might do the job after tweaking it a bit. Removes the need to invent your own versioning system thus removing the need to have version/date info in the filename. In case you can express the rules without the need for a human to look the changes through this seems to solve the task. Mercurial, SVN, Git, name your preferred one…
Post 26 Nov 2018, 13:25
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8903
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
most probably i think too highly of myself,
can't succeed to do anything actually in life, always a loser, Laughing

thats why need more life and living in good shape to try and keep on trying,

i try check on the stuffs you mentioned, thanks DimonSoft,
Post 26 Nov 2018, 16:21
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1471
Furs
Why not just use rsync?
Post 26 Nov 2018, 18:52
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 821
Location: Jakarta, Indonesia
TmX
I use Allway Sync.
My typical use case is downloading comic books on my work PC, and I want to sync them with my laptop.

Works fine. Never tried scheduling, though.
I think they should have it.
Post 27 Nov 2018, 09:46
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8903
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
rsync is ok,
just thinking to add more values, like reporting of changes, and where the changes came from,

https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?redirectedfrom=MSDN&view=netframework-4.7.2
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

http://www.go-geek.com/tips-n-tricks/monitor-directory-for-new-files-with-wsh.html
Monitor Directory For New Files With WSH
Post 28 Nov 2018, 17:51
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8903
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
here the random directories and files generator,
next is how to sync, since we got some data to play with, maybe requires a random update, delete and new,

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>

static const char *ext[] = {".txt", ".png", ".bmp", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".rtf", ".exe", ".lib", ".dll", ".wav", ".mp3", ".mp4", ".mkv"};

#define ROOT_DIR "/tmp/data/"
#define TOTAL_DIR 500
#define TOTAL_FILES 600

int indexd, indexf, indexloop;
char dirpath[TOTAL_DIR+1][500];
char currentpath[500];
char index2string[10];


time_t t;
struct timespec ts;

void createDir() {
  if( indexd <= TOTAL_DIR ) {
    sprintf( index2string, "%04d%s", indexd, "/" );
    strcat( currentpath, index2string );
    strcpy( dirpath[indexd], currentpath );
    mkdir( dirpath[indexd], 0777);
    indexd++;
  }
}

void createFile() {
  FILE *fptr;
  if( indexf <= TOTAL_FILES ) {
    // sprintf( index2string, "%s%04d%s", currentpath, indexf, ext[rand()%17] );
    // use .txt
    sprintf( index2string, "%s%04d%s", currentpath, indexf, ".txt" );
    // printf( "%s\n", index2string );
    fptr = fopen( index2string, "w" );
    if( fptr != NULL ) {
      fprintf( fptr, "%s", index2string );
      fclose( fptr );
    } else {
      exit(1);
    }
    indexf++;
  }
}

void decideDirPath() {
  int lucky;

  if( indexd == 1 ) {
    strcpy( dirpath[0], ROOT_DIR );
    strcpy( dirpath[1], ROOT_DIR );
    strcpy( currentpath, ROOT_DIR );
  } else {
    lucky = rand()%indexd;
    strcpy( currentpath, dirpath[lucky] );
    strcpy( dirpath[indexd], currentpath );
  }
}

int main( void ) {
  int i, j, k, r;
  clock_gettime( CLOCK_MONOTONIC, &ts );
  srand( (time_t)ts.tv_nsec );

  indexloop = 0;
  indexd = 1;
  indexf = 1;

  for( i=0; i<=TOTAL_DIR+1; i++ ) {
    dirpath[i][0] = 0;
  }
  
  while( indexd <= TOTAL_DIR || indexf <= TOTAL_FILES ) {

    decideDirPath();
    
    if( rand()%2 == 0 ) {
      // create directory
      createDir();
    } else {
      // create files
      createFile();
    }
    indexloop++;
  }
  
  return 0;
}
    
Post 09 Dec 2018, 07:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.