Giter Site home page Giter Site logo

autotrash's People

Contributors

bneijt avatar darwinawardwinner avatar dependabot[bot] avatar hazzl avatar jackenmen avatar javascriptdude avatar mbway avatar mithicspirit avatar ntninja avatar sidroberts avatar thiagowfx avatar topatlant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

autotrash's Issues

AUR package link not working: 404 - Page Not Found

Hello!

This is just to notify that the link on the README.md file for the Archlinux AUR package is not longer working: https://aur.archlinux.org/packages/autotrash/

I checked for the autotrash-git package page and it is not working neither: https://aur.archlinux.org/packages/autotrash-git/

Further note: error: target not found: autotrash and error: target not found: autotrash-git when trying to install from AUR.

Regards,
Ruben

Techincal question

Hey,

I'm trying to contribute some code to this project.

I'm trying to run the project from the master branch, but I keep getting an error... Should the master branch work? Do you have some simple instructions on how to run it?

P.S. Is the best way to communicate with you?

Thanks...

Documentation suggestions

  1. Since freedesktop trash is used by most desktops (including KDE), it's limiting to say that autotrash works in Gnome--it actually works on most any *nix desktop.

  2. Some explanation about the difference between installing it using pip, and installing from a distribution's repositories would be very helpful. Such as, do systemctl commands work in both types of installation?

  3. Since you list Fedora & Debian, you may not yet be aware that it's also in the OpenSUSE repo's. Tumbleweed has 0.4.4 as of this writing.

Love the script! Thanks!

Date parse error for info files

Verion Rehat Enterprise 7 RPM autotrash-0.1.5-2.el7
This appears to be the same as the current github version (15)

However it errors while cleaning up trash generated by a debian environment....

File "/bin/autotrash", line 317, in
sys.exit(main(sys.argv))
File "/bin/autotrash", line 251, in main
file_time = trash_info_date(file_name)
File "/bin/autotrash", line 101, in trash_info_date
return time.strptime(parser.get(section, key), '%Y-%m-%dT%H:%M:%S')
File "/usr/lib64/python2.7/_strptime.py", line 467, in _strptime_time
return _strptime(data_string, format)[0]
File "/usr/lib64/python2.7/_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: .710Z

Please make a flatpak package

Hi,
I'm trying to use autotrash, it's installed with pipx, but it doesn't work. I got only
Found trash directory: /home/max/.local/share/Trash

It depends on python2? On python3? Is it any missing library?
Please make a flatpak package.

Custom remove action

Move files from the trash to a directory (ignoring trash metadata), instead of throwing them away.

Meant for extra backups on external storage.

New release?

Hi!
0.1.5 is quite old now: why don't you rename the latest version in 0.1.6 and create a new tarball?
This could be useful for non-Debian users, because we don't have docbook-to-man and instant in order to create man pages (which are included only in your release tarball).

Thank you!

autotrash: error: no such option: -t

OS: Ubuntu 16.04.3 LTS
When I run this command:
autotrash -td 30

It shows an error:

Usage: autotrash -d <days of age to purge>

autotrash: error: no such option: -t

PackageNotFoundError not ignored when looking for package version

When looking for the package version, we might hit

Traceback (most recent call last):
  File "/usr/bin/autotrash", line 33, in <module>
    sys.exit(load_entry_point('autotrash==0.4.4', 'console_scripts', 'autotrash')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/autotrash", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 981, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for autotrash

in certain install environments. This should just be ignored to result in a working autotrash without the version being known at runtime.

Arrow dependency unnecessary?

Both setup.cfg and pyproject.toml indicate that autotrash depends on arrow, but when looking through the source (or grepping arrow), it does not appear to be used anywhere. Am I missing something or is the dependency unnecessary?

[Suggestion] Add to AUR

It would be nice if autotrash was added to the Arch User Repository (or even better would be the main Archlinux repos). I know that it can just be installed with pip but I (and I think most other people) prefer to have most things on a single package manager rather than a ton of different ones.

Don't Delete Files Younger Than a Certain Age

Hello!

When the hard-disk runs out of space completely, --min-free would empty the trash completely – including files the user deleted just half an hour ago.

However, when the drive runs full, there probably is something wrong and the deletion of very young files in the trash could turn out as unnecessary after the problem is fixed. So, in my opinion, it would be nice to add an option to safe files from deletion until they reach a certain age. For example:

autotrash --min-free 2048 --min-days 7

would delete all files until either 2048 MB are free or only files deleted within the last seven days are left.

What do you think?

ValueError: unconverted data remains: .405Z [Linux Mint 19.3]

Hi,

This is similar to #15 but happens only on one of my two PCs on Linux Mint 19.3 (the other PC runs it fine).

$ autotrash -d 30
Traceback (most recent call last):
File "/usr/bin/autotrash", line 317, in
sys.exit(main(sys.argv))
File "/usr/bin/autotrash", line 251, in main
file_time = trash_info_date(file_name)
File "/usr/bin/autotrash", line 101, in trash_info_date
return time.strptime(parser.get(section, key), '%Y-%m-%dT%H:%M:%S')
File "/usr/lib/python2.7/_strptime.py", line 478, in _strptime_time
return _strptime(data_string, format)[0]
File "/usr/lib/python2.7/_strptime.py", line 335, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: .405Z

Thank you.

DeprecationWarning: SafeConfigParser

Using Tumbleweed, I'm getting the following warning at the command line:

/usr/bin/autotrash:96: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
parser = configparser.SafeConfigParser()

crashes on corrupt (?) .trashinfo file

$ apt-cache show autotrash
Package: autotrash
Priority: optional
Section: universe/utils
Installed-Size: 31
Maintainer: Lorenzo De Liso <[email protected]>
Architecture: all
Version: 0.1.5-1.1
Depends: python (>= 2.5)
Filename: pool/universe/a/autotrash/autotrash_0.1.5-1.1_all.deb
Size: 9242
MD5sum: 52d0cc5d855e4ce3151b447c7251ce15
SHA1: cafdc04f1f67ccf5017da8be0329688a23594948
SHA256: 32b207f642663f25add2740fc6bf55a257149f5060d2df51b53a7d1151e3e8d1
Description-en: purges files from your trash based on age and/or filename
 A script useful to purge files from your trash based on their age.
 It can also be used to purge the files based on the filename
 using a regular expression.
Description-md5: ef1da8d069fca1d8bc8f079afd754d5f
Homepage: http://www.logfish.net/pr/autotrash/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

Observed behaviour:

$ autotrash -d 60
Traceback (most recent call last):
  File "/usr/bin/autotrash", line 317, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/autotrash", line 251, in main
    file_time = trash_info_date(file_name)
  File "/usr/bin/autotrash", line 96, in trash_info_date
    readCorrectly = parser.read(fname)
  File "/usr/lib/python2.7/ConfigParser.py", line 305, in read
    self._read(fp, filename)
  File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /home/me/.local/share/Trash/info/IMG_9597.jpg.trashinfo, line: 1
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

$ hexdump /home/me/.local/share/Trash/info/IMG_9597.jpg.trashinfo
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
00000b3

The test file is at http://filebin.net/a7uysrqb1h – but I suppose any file with just a bunch of NUL's will make it crash.

Expected behaviour: Warn about it, but keep trashing.

I can't install it.

System: Ubuntu 20.04 LTS (WSL);

I input :

sudo apt install -y autotrash

And it said :

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package autotrash is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'autotrash' has no installation candidate

run at startup?

I'd like this to run at startup with a zero-day value - in other words, empty my trash each time I log in to my desktop. Is that doable? Can I add it to my [Linux MInt] startup items with a zero day value or would some other command work?

Thanks.

Consider creating Snap package

The probably most popular distros - Debian 11+/Ubuntu 18.10+ and Fedora 30+ - do not have the autotrash package in their repositories anymore. Arch and openSUSE Tumbleweed seem to be the only two mainstream distros that do have an up-to-date package.

Would you consider creating a Snap package for this project if someone (maybe me 🙂) contributed it along with the CI setup? Currently the only way to install autotrash on one of the aforementioned distros seems to be installing autotrash with pip in ~/.local/bin but considering that this project can auto-delete all trash directories, not just the one in one's home directory it is not ideal to have a non-global binary for it. An added bonus would be auto-setup of a systemd service which can also be done by snap.

Use $XDG_CONFIG_HOME rather than assuming ~/.config

I have configured my system to put the systemd configuration in a different directory. So running autotrash --install fails since it puts the generated timer and service files in the typical location without checking the environment.

Suggested cron syntax doesn't work

The crontab entry recommended in the readme has multiple issues

# Wrong install location as of v0.1.5 (should be /snap/bin/autotrash)
root@ubuntu# /usr/bin/autotrash -d 30
-bash: /usr/bin/autotrash: No such file or directory 

# Looks at root's trash instead of a user's
root@ubuntu# autotrash -d 30
Can not find trash information directory. Make sure you have at least GNOME 2.24
I was looking at: /home/root/.local/share/Trash/info

# Still errors even with explicit -T that is confirmed to exist
root@ubuntu# ls /home/addison/.local/share/Trash/info
test.trashinfo
root@ubuntu# autotrash -d 30 -T /home/addison/.local/share/Trash/info
Can not find trash information directory. Make sure you have at least GNOME 2.24
I was looking at: /home/addison/.local/share/Trash/info/info

I would expect the last correction to work, but it still doesn't. Perhaps its a permissions issue?

Option to purge trash of all users when running as root

After making issue #47, I realised that autotrash doesn't actually take out purge other user's trash when using --trash-mounts option. If I knew that I would have probably waited with asking about the snap package until this feature is implemented (and if it's accepted, to begin with of course) since it kinda doesn't make as much sense to create a snap package if all of the functionality is local to the user that runs autotrash command rather than all users.

Anyway, I think it would be great to have an option to purge trash of all users so that one could run autotrash as a system service and have it take care of everyone's Trash automatically. It's way easier than setting up a separate service for each user and also makes autotrash actually run for users that you're not logged into as opposed to user services that only run while you're in a user session.

Ubuntu (and Debian? ) install instruction issues

The installation instructions listed for Ubuntu/Debian no longer work, I believe autotrash has been abandoned by Debian. pip install --user autotrash also no longer works; it fails with a message starting: “This environment is externally managed…”

The simplest installation I could find is:
$ sudo apt install pipx
$ pipx install autotrash
$ autotrash -d 90 --install

Thanks,
Lance

Syntax error def read_datetime(value: str) -> datetime.datetime:

I am getting this:

$ autotrash -d 30
Traceback (most recent call last):
File "/home/rsholmes/.local/bin/autotrash", line 5, in
from autotrash.app import main
File "/home/rsholmes/.local/lib/python2.7/site-packages/autotrash/init.py", line 8, in
from .app import *
File "/home/rsholmes/.local/lib/python2.7/site-packages/autotrash/app.py", line 104
def read_datetime(value: str) -> datetime.datetime:
^
SyntaxError: invalid syntax

Using recently downloaded autotrash, Linux Mint 20 Cinnamon

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.