Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bamboo

Bamboo is a python based simple command line tool for creating regular file transfer and backups. Bamboo provides simple yet useful features to automate the file transfers as per configurations.

Build

python setup.py bdist_wheel

Installation

Grab the wheel from the release or build from source. Download bamboo 0.1 wheel.

python -m pip install bamboo-0.1-py3-none-any.whl

And bamboo should be available from the terminal

Examples

bamboo device will list down all known devices, mount points and show if they are online

$>bamboo device
*Camera (0.35)	: /run/media/rahul/mtp:host=Canon_m6112/
Lens	:/run/media/rahul/Lens
OnePlus6    :/run/user/1000/gvfs/mtp:host=OnePlus51201/Internal shared storage/

bamboo profile will list down all configured profiles

$>bamboo profile
sample_profile   : Lens    ==> PC   
OP6_photo_sync   : OnePlus6   ==> Lens

bamboo run <profile1> <profile2> ... <profileN> will backup as per the provided sync profiles (in the order of arguments)

$>bamboo run sample_profile
Syncing:demo
Gathering info ...
7 files found 8.14 MB are to be transferred. continue ? (y) : y
device1:/home/rahul/PythonProjects/in/ -> device2:/home/rahul/PythonProjects/out/ 
Progress : 7/7 	 Transferred 8.14 MB         
complete!
Sync for profile:sample_profile completed

Or bamboo run --auto will automatically do backups as per available devices

Configuration

bamboo configuration home needs to be created under user home directory and underlying directories for device and profile configurations

  • <user_home>/.config/bamboo
  • <user_home>/.config/bamboo/devices
  • <user_home>/.config/bamboo/profiles

Device

To add a device a <device_name>.json needs to be created under <user_home>/.config/bamboo/devices with mount point information.

{
    "mount_point" : "/run/media/rahul/Lens"
}

Profile

Profiles are a set of file transfers that fall under a logical group. Profiles contain sync entries, these describe file transfers in more granular level.

For example, transferring files from your DSLR camera could be a sync profile. 2 sync entries would be there to move RAW and Regular JPEG files to different directories. And there could be another profile to sync the video files which is rarely used.

To add a profile a <profile_name>.json needs to be created under <user_home>/.config/bamboo/profiles. Profiles contain a source and a target device (names should be as per device configuration). And it contains N number of sync entries.

sync entries take following keys,

  • name
  • source This is relative to the source device mount point
  • target This is relative to the target device mount point
  • filter_regex (optional) A list of regex to match against filenames. If none of the regex match the file will be excluded.
  • retention_period (in days) (optional) If mentioned files modified under the retention period will not be deleted from source location.
{
  "source_device": "device1",
  "target_device": "device2",
  "sync_entries": [
    {
      "name": "demo",
      "source": "home/rahul/demo/in/",
      "target": "home/rahul/demo/out/",
      "filter_regex": [
        ".*.jpg$"
      ],
      "retention_period": 5
    }
  ]
}

Uninstallation

python -m pip uninstall bamboo

Contributing

Pull requests and suggestions are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project status

This project is currently actively maintained by me.

About

A command line file transfer and backup utility

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages