chriscz / pysorter

A command line utility for organizing files and directories according to regex patterns.
Mozilla Public License 2.0
44 stars 17 forks source link

Creating a revert feature to return to last state. #24

Open zeerorg opened 8 years ago

zeerorg commented 8 years ago

Can we create a '.pysorter' file in the directory so that we store changes done. and later on maybe revert back to the previous directory state using a '--revert' flag?

This can also be done while logging to standard output.

chriscz commented 8 years ago

This is a great idea. The .pysorter file would work well. I am not sure what the best format for it would be, maybe json is a good pick here. Please look at the comments in PR #20, which will be merged soon. Another related feature which is almost done is #14.

Thanks for your support!

zeerorg commented 8 years ago

I was thinking we could have json with something like

{
    date:"current_date",
    time:"current_time",
    src:["path/to/file1", "path/to/dir"],
    dest:["newpath/to/file1", "newpath/to/dir"]
}
chriscz commented 8 years ago

That looks good for now.

zeerorg commented 8 years ago

sorry for a lame question but I wanted to ask how can I run pysorter after git cloning. I basically do

python __main__.py "path/to/directory"

and it gives me an error File "__main__.py", line 3, in <module> from .core import pysorter SystemError: Parent module '' not loaded, cannot perform relative import

chriscz commented 8 years ago

python -m pysorter should do the trick. Here we run the pysorter package as if it was a program.

I'd recommend creating a virtualenv and installing all the requirements in there. Then you can install it in editable mode with pip install -e . To quote the documentation:

-e, --editable <path/url>   Install a project in editable mode (i.e.
setuptools "develop mode") from a local project path or a VCS url.