2 changed files with 17 additions and 2 deletions
@ -1,3 +1,4 @@ |
|||||
# photosort |
# PhotoSort |
||||
|
Bash script for sorting [PhotoRec](https://github.com/cgsecurity/testdisk) recovered data, but can be used for sorting any data by extension. |
||||
|
|
||||
Bash Script to sort files into directories based on extension. |
[PhotoRec](https://github.com/cgsecurity/testdisk) sorts data in many directories, with no organization by filetype. This script creates a new directory with subdirectories for every filetype recovered by [PhotoRec](https://github.com/cgsecurity/testdisk), then moves files into their corresponding place. |
||||
|
|||||
@ -0,0 +1,14 @@ |
|||||
|
#!/bin/bash |
||||
|
echo "PhotoRec Recovered Data - Source Folder?" |
||||
|
# Example - /home/user/rootfolderofphotorecdata |
||||
|
read sourcefolder |
||||
|
echo "Destination Folder?" |
||||
|
# Example - /home/user/rootfolderofphotorecdata/SORTED (will be made if doesn't exist) |
||||
|
read destinationfolder |
||||
|
cd $sourcefolder |
||||
|
mkdir $destinationfolder |
||||
|
for extensions in $(find . -type f -name '*.*' | sed 's|.*\.||' | sort -u) |
||||
|
do |
||||
|
mkdir $destinationfolder/$extensions |
||||
|
find $sourcefolder -name \*.$extensions -exec mv {} $destinationfolder/$extensions \; |
||||
|
done |
||||
Loading…
Reference in new issue