Sharry supports large grouped uploads of files, but doesn't have a "Download all" option at present.
This bash script combines the locally stored database chunks back into complete files to avoid manually downloading individual files.
I hosted a Sharry instance for wedding guests to upload photos and videos. Then I had hundreds of files and had to click download on each individually. The file data was on the server, just in chunks. Now I can point this script at the database directory and it will combine the chunks back into files.
Backup your database before you let a script loose on it.
Your Sharry instance needs to be configured to use local filesystem for file storage. If you already have the files configured with a different database, change file store.
git clone https://github.com/mpdcampbell/sharry-chunk-combiner.git
Make the script executable.
chmod +x chunkCombiner.sh
The script requires two input arguments to work, -d and -o, explained below.
Usage: chunkCombiner.sh [-d -o -h]
Mandatory Flags.
-d Path to Sharry filesystem database directory.
-o Path to directory to output rebuilt files.
Other Flags.
-h Show usage.
So for example run the script with:
./chunkCombiner.sh -d ~/sharryDatabase/ -o outputDirectory
The script has a few main limitations:
- Original filenames are lost.
- If the file mime-type isn't in the dictionary, it wont be assigned. The file will still be rebuilt just without an extension.
- It uses associate arrays, added with Bash 4.0 in 2009. By default Mac OS only has Bash 3.2 because of licensing.
GNU General Public License v3.0 or later
See COPYING to see the full text.