Quick start with CLI¶
You have three places with you files:
Home descktop - with original files.
Flashdrive - with copies.
Work descktop - with copies.
You wish have identical copies of files in all places. Also you flashdrive will be save this files as backup copy. Also you wish easy synchronize you copies after editing files.
In home descktop you keep original files in different directories:
/home/user/docs1/...
- any documents.
/home/user/memo.txt
- file which you edit often (evry day for example).
/home/user/news/...
- directory with downloaded news (you download news and read they then you have free time).
We will have 2 points of synchronization:
Home desktop and flash drive. Bag will be on the flashdrive. Origin files will be on home desktop.
Flashdrive and work desktop. Bag will be on the work desktop. Origin files on the flashdrive.
Now start use of PYBAG.
Create bag directory in flash drive:
/flash/bag/
Copy to this directory file pybag.py
or distribute they from existings location:
python pybag.py --dist -m0 /flash/bag
where m0
- turn off emulation mode (this mode turn on by default to prevent inaccurate use of program).
/flash/bag/ ………..pybag.py
Change working directory to /flash/bag
:
cd /flash/bag
Initialize pybag files into current (/flash/bag
) location:
flash/bag > python pybag.py --dist -i -m0
Also you can run program with needed command. If current program location not initialized, then you asked for initialization. You can answer y and after initialization command execution will be continued.:
/flash/bag/
...........pybag.py
...........pybagfiles/
...........pybag.cfg
...........pybag.db
Add origin roots to bag:
flash/bag > python pybag.py --add -kc -e".*,*~" "/home/user/docs1" "/home/user/memo.txt" "/home/user/news"
where kc
- copy symlink (or ignore if use -ki
),
e".*,*~"
- ignore all hidden files (started from dot),
and ignore all backup copies (ends with tilda).
Last parameters - paths to directories and files that you want add to bag.
Now you must synchronize you bag:
flash/bag > python pybag.py --sync -m0
You see that in origin will be found number new items
(it is you three roots and all items into this directories).
Also you see report about number items which will be ignored.
If you wish view more detailed report you must use
option -v4
(default is -v3
).
Also detailed report into logging file into bag directory pybag.log
.
You view report about files which changed and will be synchronized and prompt Enter action (h - for help): and if you agree with report you may answer y to continue or n for cancel.
Also you can pres h and view available options.
/flash/bag/
...........pybag.py
...........pybagfiles/
......................docs1/
............................ ... any files
............................ ... any files
......................news/
............................ ... any files
............................ ... any files
......................memo.txt
...........pybag.cfg
...........pybag.db
You flash drive now is full synchronized with you home descktop.
You go work and create into work descktop bag which will be synchronized with you flash drive.
Create bag into work desctop:
/work/user/bag
Change working directory to flash bag:
cd /flash/bag
Distribute all roots from flash bag to working bag:
flash/bag > python pybag.py --dist -i -a -m0 "/work/user/bag"
Change working directory to working bag:
cd /work/user/bag
View synchronization report:
work/user/bag > python pybag.py --sync -m0
and continue synchronization if agree with report.
Now you can work with you files in work descktop.
Befor you go home you must synchronize bag:
work/user/bag > python pybag.py --sync -m0
When you coming to home you also synchronize:
flash/bag > python pybag.py --sync -m0
All changes will be writen to home descktop.
For detailed program features see section about commands.