Combining the functionality of previous 2 projects in an interactive popup.
First is a pdf merger whereby users can choose a folder and all the pdfs within it will be appended according to the listing as listed in the file explorer. Second is a file sizer that enumerates recursively the folder chosen to list out all files in descending order of file size, to help with file management/deletion. I have a pre-made folder named 'C:\walktest' for demonstration purposes. The folder hierarchy is as follows:
The popup appears for the user to choose the next action: merging pdf files or getting file sizes of all files in a path
If the user clicks on pdf merger, the next popup will show:
THe user can then click on browse to open a file explorer and choose a folder with contents of pdf files to merge:
The user will then name the output pdf merged file:
The user will confirm the chosen folder with displayed pdf contents:
Upon successful merger, a popup will notify the user:
If the user clicks on the file sizer, the another popup will appear to prompt the user on what folder to enumerate:
When the user clicks on browse, the file explorer opens for the user to choose the desired folder:
The user then names his desired output file. The output is a text file in a report format with headers of file size in KB followed by full filepath. This report is arranged in descending order of file size, largest file being at the top. I desinged it this way so that I can easily see what files are taking up the most space and if they are up for deletion.
Upon successful report creation, a popup will notify the user accordingly:
The file output is as follows, and is correctly created. We can also see that our previously created 'merger_demo.pdf' has also been accounted for:
-More similar to replicating the 'tree /f' windows command
-Added file sizes alongside so can view
-Issue: Don't think can sort by file size since os.walk sets up a tuple with strings and lists. Hmm. Thinking
Seems like this cannot successfully enumerate the whole C drive. And even if it manages to, the txt file is very large and will freeze the pc. hmm. should be due to enumerating over too many files and failing. However python error output suggests that its just due to formatting error from not setting utf-8 format. hmm.