Browse Source

Upload files to ''

master
Joshua Pickard 5 years ago
parent
commit
546ffdbac1
  1. 5
      README.md
  2. 14
      photosort.sh

5
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.
[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.

14
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
Loading…
Cancel
Save