Skip to main content

A little commandline tool to copy and paste multiple files and directories to single directory with use of configuration

Project description

Copy-to

A little python script I use in conjunction with git so you can easily copy (config) files located outside of a git repository to one (or to wherever you want to). Useful for dotfiles and such.

Depends on argcomplete, GitPython, prompt_toolkit

Install it with:

Linux:

sudo apt install pipx / sudo pacman -S python-pipx
pipx install copy-to

Windows Powershell:

python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install copy-to

On linux, try running it once if autocompletions aren't working

You can also run:

sudo activate-global-python-argcomplete

Sadly I have been unable to figure out as of now how to setup autocompletions on Windows.

Add a pairset of destination folder - source files and/or directories with

copy-to add myname destination_folder sourcefile1 (sourcefolder1 sourcefile2 sourcefile3 sourcefolder2/*) ...

Copy the files to their destination by running

copy-to run myname1 (myname2)

Or copy the files back to source by running

copy-to run-reverse myname1 (myname2)

When the destination is missing, a prompt will ask you if you want to create the destination folder.

Run and run-reverse can also run without arguments when present in a git repository that has configured copy-to (Excluding global gitconfig). This is so it can be hooked to a git macro more easily, f.ex. with an alias (alias git-status="git status && copy-to run") or on startup of Lazygit.

[copy-to]
    run = myname1 myname2
    file = myconf.json

This can be setup with copy-to add myname and copy-to set-git myname or
copy-to add myname and copy-to run/copy-to run-reverse after wich a prompt will ask if you want to set it up with git. Both copy-to run and copy-to run-reverse will run using the same run arguments. A custom conf.json can be also be setup and will always take precedence over other file options when set up.

Quick setup for dotfiles

This will setup a git repository for your firefox and thunderbird configuration files using copy-to.

List configured paths and files with

copy-to list myname/mygroupname/all/all-no-group/groups/all-groups/names/groupnames/all-names

or as a flag

copy-to --list othercommand

'all-no-group' and 'groups' to list all regular configs and groups respectively
'names' and 'groupnames' to list just the regular names and groupnames respectively
You can also use 'all' to list/run all known configurartions

Delete set of dest/src by name with

copy-to delete myname1 (myname2)

Add sources with

copy-to add-source myname folder1 file1

Delete source by index with

copy-to delete-source myname 1 4 7

Reset source and destination folders

copy-to reset-source myname
copy-to reset-destination myname newDest

Groups are based on names. For copying to multiple directories in one go.
Groupnames 'group'/'all' cannot be used.

Add groupname

copy-to add-group mygroupname myname1 myname2

Delete groupname

copy-to delete-group mygroupname

Add name to group

copy-to add-to-group mygroupname myname1 myname2

Delete name from group

copy-to delete-from-group mygroupname myname1 myname2

At default the configuration file is located at ~/.config/copy-to/confs.json, but you can set a environment variable COPY_TO to change this, or pass a -f, --file flag.

Mac not tested

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copy-to-1.3.6.4.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

copy_to-1.3.6.4-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page