From 546ffdbac1ff0c3cdb0a022b1c4746ff37c4276e Mon Sep 17 00:00:00 2001 From: jpickard Date: Wed, 8 Dec 2021 17:16:20 -0500 Subject: [PATCH] Upload files to '' --- README.md | 5 +++-- photosort.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 photosort.sh diff --git a/README.md b/README.md index d0db4bf..d93142b 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +[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. diff --git a/photosort.sh b/photosort.sh new file mode 100644 index 0000000..865adf6 --- /dev/null +++ b/photosort.sh @@ -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