Skip to content

Bash script builds local Sharry database chunks back into full files.

License

Notifications You must be signed in to change notification settings

mpdcampbell/sharry-chunk-combiner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alt_text sharry-chunk-combiner
License

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.

Example

Demo of Script

Why make this?

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.

How to use?

  1. Backup your data
  2. Check Sharry configuration
  3. Clone this repo
  4. Run script

0. Backup your data

Backup your database before you let a script loose on it.

1. Check Sharry configuration

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.

2. Clone this repo

git clone https://github.com/mpdcampbell/sharry-chunk-combiner.git

3. Run the script

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

Limitations

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.

License

GNU General Public License v3.0 or later

See COPYING to see the full text.

About

Bash script builds local Sharry database chunks back into full files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages