Search code examples
pythonfile-managementutility

Print all files in the sub-folders of a folder


I'm planning on using Robobasket to organise my folders like this,

Invoices - Jan/Feb/Mar - Customer Number 1/Customer Number 2 - Then the dates the invoices actual arrived on

The files are named, Month/Customer Number/Date.

What I need to be able to do is, right click on the month, and have it print all the invoice for that month. Specifically printed out by Customer Number 1, then all the dates in order, say 3rd, 17th, 31st, then Customer Number 2, 12thst 22nd, etc.

I have several thousand invoices a month, so you can see why manually printing, even just by Customer number is not something I can do.

The system is running Windows 7, although any programs which can work with a server would be great too, as it's entirely possible, that'll happen soon.

I have basic script skills in C, Python, and Forthe; But am willing to learn for the sake of this issue.

The important thing is that someone who has very little computer skills can at the end of this set it going. Hence the desire for it to be accessible through the context menu.

Any and all help would be appreciated.


Solution

  • You have to do multiple things to get that working.

    1. You need a Python environment installed on the machine or you have to pack your script as an executable. Use py2exe for this.
    2. To get all the files in a given directory, you could use the glob module from python, if you need to filter. Or you could use the approach from denis.
    3. You have to add a context menu item via the registry or using a context menu editor. Look there for an instruction.
    4. Ideally, you pack everything into an installer to distribute the stuff. Including a batch script that adds the context menu item to the registry.