File System API

Download folder/file from remote server with fzf for beautiful interface & simple usage.

Remote server installation

Installation

cd /var/www
git clone https://github.com/Mediashare/FileSystemApi api
cd api
1
2
3

Config

Add path folder you need to share in $directories array.

<?php
// ./config.php
$directories = [
    'movies' => '/home/username/Movies',
    'pictures' => '/home/username/Pictures',
];
1
2
3
4
5
6

Tools for local installation

Requierements

  • fzf is a general-purpose command-line fuzzy finder.
  • fd A simple, fast and user-friendly alternative to 'find'

Downloader

#!/bin/bash
# ./tools/download.sh
# Download folder/file from raspberry server
# curl http://exemple.com/api/ | fzf | xargs -I {} scp -r username@exemple.com:"'{}'" $1
if [ $# -eq 0 ]
  then
  	1="."
fi
scp -r username@exemple.com:"'$(curl http://exemple.com/api/ | fzf)'" $1
1
2
3
4
5
6
7
8
9

Uploader

#!/bin/bash
# ./tools/upload.sh
# Upload folder/file from raspberry server
if [ $# -eq 0 ]
  then
    echo "This command need a folder path. (exemple: '/home/username/Pictures')"
    exit 1
fi
scp -r "$(fd | fzf)" username@exemple.com:"$1"
1
2
3
4
5
6
7
8
9
Last Updated: 1/15/2020, 3:10:39 PM