GithubHelp home page GithubHelp logo

pycp's Introduction

pycp: cp and mv with a progressbar

http://img.shields.io/pypi/v/pycp.png

What it looks like:

https://raw.githubusercontent.com/your-tools/pycp/master/scrot/pycp.png

See pycp --help for detailed usage.

Development happens on github

Installation

pycp works both for any version greater than Python 3.4, and is installable with pip.

For Archlinux, a PKGBUILD is also available on AUR

Notes

  • Implementation heavily inspired by the wonderful library progressbar by Nilton Volpato.
  • I also maintain a similar tool written in rust called rusync. It has a different set of features (so you may want to stick with pycpy), but is much faster.
  • If you are looking for a ncurses-based solution, vcp maybe the right choice for you http://www.freebsdsoftware.org/sysutils/vcp.html
  • If you are looking for a more general solution to display progress bars when performing command-line operations, see clpbar: http://clpbar.sourceforge.net/

pycp's People

Contributors

dmerejkowsky avatar timgates42 avatar aldrik avatar cgestes avatar toofar avatar

Stargazers

immateria avatar Pablo avatar George Kontridze avatar  avatar Ali Alsabbah avatar Debopam Gupta avatar Omansh Krishn avatar  avatar  avatar  avatar Md Safiyat Reza avatar  avatar Stefan Gerber avatar CanoeIng avatar Ryan Fortner avatar Jai A P avatar Jamie Sparks avatar Tomas Sandven avatar Tharindu N. Madhusanka avatar Mike avatar  avatar Juste Elysée M. avatar Etienne Faisant avatar Bocke avatar Sayantan Santra avatar Kovarththanan Rajaratnam avatar  avatar Danaru avatar Mike Place avatar Asher Peruscini avatar KTR x GTR avatar  avatar Athul K A avatar Abdur-Rahmaan Janhangeer avatar  avatar spike5 avatar Xiangyu Xu avatar William avatar Yazdan Mohammadi avatar Chlins Zhang avatar Andres Cuervo avatar  avatar  avatar Gavin C avatar Amey Khairnar avatar Andreas Mausch avatar Kevin Mok avatar al123xiaaaa avatar Pavel Serikov avatar Jarosław avatar arkhan avatar Will Price avatar Rocco avatar  avatar  avatar  avatar Vidit Ochani avatar  avatar Wayne Wu avatar GAURAV avatar  avatar Sean P. McAdam avatar  Vadim Smirnov avatar Johannes Trommer avatar Woodsy avatar Serapis avatar Brendan Weibrecht avatar whoami avatar Travis Grammer avatar Roni Laukkarinen avatar Frederick Wagner avatar  avatar Nikolay Kolev avatar Sebastian avatar  avatar Benjamin Hedrich avatar Olivier Mengué avatar Eric G. avatar Angus H. avatar  avatar Tucanix avatar  avatar Skyler Forge avatar  avatar Shivam Rana avatar Nikhil Mittal avatar Chaitanya Gupta avatar Shadab Zafar avatar Minho Ryang avatar  avatar Mohamed Meabed avatar Imants Švarcs avatar Adam Porter avatar Reid Kleiner avatar Richard Watt avatar Adam Hubscher avatar William Falk-Wallace avatar Mike D avatar Jared Vogt avatar John Olinda avatar

Watchers

 avatar James Cloos avatar  avatar  avatar arkhan avatar  avatar  avatar  avatar  avatar spike5 avatar  avatar  avatar

pycp's Issues

man pages are gone

Installed binaries crash with pkg_resources.DistributionNotFound when called during packaging.

Probably best to write a real doc in sphinx and let sphinx generate the man pages instead.

-g flag crashes pycp

When I do pycp -g (directory) (directory) I get the following:

Traceback (most recent call last):
  File "/usr/sbin/pycp", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/pycp/main.py", line 114, in main
    errors = transfer_manager.do_transfer()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 354, in do_transfer
    error = ftm.do_transfer()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 188, in do_transfer
    self.transfer_file()
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 229, in transfer_file
    self.callback(transfered)
  File "/usr/lib/python3.6/site-packages/pycp/transfer.py", line 339, in on_file_transfer
    self.progress_indicator.on_progress(progress)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 517, in on_progress
    self._render_second_line(progress)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 511, in _render_second_line
    filename=progress.src,
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 391, in render
    length, string = component.render(kwargs)
  File "/usr/lib/python3.6/site-packages/pycp/progress.py", line 252, in render
    return len(text), text
TypeError: object of type 'NoneType' has no len()

easy_install on mac results in SandboxViolation

Just did a sudo easy_install pycp on my mac and got this error:

Searching for pycp
Reading http://pypi.python.org/simple/pycp/
Best match: pycp 6.1.2
Downloading https://pypi.python.org/packages/source/p/pycp/pycp-6.1.2.tar.gz#md5=6f370ea0d19fbc495c00a9c8d0973e7a
Processing pycp-6.1.2.tar.gz
Running pycp-6.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-znaR6L/pycp-6.1.2/egg-dist-tmp-fawFiu
/bin/sh: help2man: command not found
/bin/sh: help2man: command not found
error: Setup script exited with error: SandboxViolation: open('/usr/share/man/man1/pycp.1', 'wb') {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

Progressbar sometimes too long

Steps to reproduce:

pycp /veeeeeeeeeeeeeeerrrrrrrrrrrrry/looooooooooooooooooong/paaaaaaaaaath/{src,dest}

The problem is that the output of describe_transfer is not guaranteed to take less than the line width, and after that it's too late to know which segment of the line should be truncated

Implement pycp --continue

Like wget -c, or rsync --append pycp could optionally support appending stuff to the end of a partially copied file

pymv doesn't preserve timestamp

i used pvmv to move files from one drive to another and was surprised to find out it didn't preserve my orginal time-stamped info ion the files.. please make it default behavior.

please add preserve timestamp switch/operator for pycp too.

Add pyrm

I really like pycp+pymv.

Would it be possible to add a pyrm that performs an rm?

pycp crashes when file size changes during transfer

If the file size increases while it's being transferred, pycp may crash with an assertion failure here

def on_file_transfer():
    self.global_pbar.update(xferd) 

def fraction()
    res = float(curval) / maxval
    assert res > 0
    assert res < 1
    return res

We can't really assume that xferd will always be smaller than src file size !

pycp is slow

version 8 is slower than 7, which is slower than cp, and not by a small margin.

Ideas:

  • Optimize usage of python-cli-ui
  • Use 2 processes, one for the disk I/O, and an other one for the output
  • Throttle console output
  • Use async stuff ?
  • Rewrite in an other language. Rust ? Javascript ?

But first we need to do some serious benchmarking ...

Colorization of output

Are there any possibilities to add colorization to this tool? Everything is brilliant but absent of colorized stdout is real issue when copying/moving multiple files in bulk.

cp cp --reflink=auto feature

I am using Fedora 35 XFCE edition. One thing I have noticed:

I copied a 27 GB folder in Thunar in the same drive, the GUI file manager of XFCE. It took 4 seconds to copy.

If I run sudo btrfs fi du ~

It shows 27 GB is shared. In other words, only metadata was copied, not the actual data.

But if I use pycp on the same folder, it takes a few minutes to copy to the same drive. It means pycp is duplicating the files. I can see the free space also decreases.

I found here

that we can use cp --reflink=auto to copy with deduplication.

Is it possible to integrate this behavior of Thunar in pycp where it copies with de-duplication?

Thanks! 🙏🏽

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.