Skip to content

A python script to sort folders generated by photorec, or any folder by filetype and size.

License

Notifications You must be signed in to change notification settings

miampf/photorec-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

photorec-sort.py

This is a python script that's supposed to sort the output of PhotoRec by file types and size. However, it should be able to recursively sort any folder by filetype and size.

For that, it will create a folder structure that will be similair to this one:

mp4
|__ 0_1
    |__ file.mp4

To use it, you need python installed, then run

python photorec-sort.py <SIZE_INCREASE> <PHOTOREC_FOLDER> <OUTPUT_FOLDER>

where SIZE_INCREASE is the size difference for sorting in GiB (in the folder structure above, this would correspond to a 1, since the subfolder is 0_1, so 0-1 GiB), PHOTOREC_FOLDER is the folder of the PhotoRec recovery and OUTPUT_FOLDER is the folder where the new sorted filesystem will be generated and the files will be moved.

Note that the files of the PHOTOREC_FOLDER will be MOVED into the OUTPUT_FOLDER, not copied.

Example

Imagine you have the following folder structure:

test
├── asdf
│   ├── 1.txt
│   └── 2.txt
├── something
│   └── 1.png
└── uwu
    ├── 1.exe
    └── 2.bat

Here, 1.txt, 2.txt and 1.exe are 1 GiB large, 2.bat is 4 GiB large and 1.png has a size of 2 GiB. If you now run python photorec-sort.py 1 ./test ./out, the out folder has the following structure:

out
├── bat
│   └── 3_4
│       └── 2.bat
├── exe
│   └── 0_1
│       └── 1.exe
├── png
│   └── 1_2
│       └── 1.png
└── txt
    └── 0_1
        ├── 1.txt
        └── 2.txt

About

A python script to sort folders generated by photorec, or any folder by filetype and size.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages