I run a paperless lifestyle. At the end of the year, I archive my financials yearly. So basically, I move all the contents into a zip file, then move that zip file out of my documents and into an archives folder. I then have to remake all of the folders.
This is what I would like to do:
-
The script copies the folder structure (probably will require a recursive flag of some sort). (Not sure how to do this part).
-
The script compresses the folder (containing all of the other folders) and moves the zip to the archives folder. (This is easy, it’s just zip and mv commands)
-
Take the copied folder structure and essentially rebuild it back without all of the actual files. (This part depends on 1)
I originally was just going to individually type the “mkdir /users/name/documents/financials/banking/whatever here” lines, but the script would need modified every time I open a new line of credit or need a new folder for whatever reason.
As I was typing this, I’m thinking maybe it could be done in Python as well. I’d have to research what the OS library in Python can do. Especially if I can just loop through and store the current working directory.
Edit: I haven’t tested it yet, but apparently something like “find -type d -links 2 -exec mkdir -p “/path/to/backup/{}” ;” will work.