GithubHelp home page GithubHelp logo

filebrowser's Introduction

Whiptail bash script directory browser and File Selector

filebrowse.sh written by Claude Pageau

RPI Quick Install or Upgrade

Step 1 With mouse left button highlight curl command in code box below. Right click mouse in highlighted area and Copy.
Step 2 On RPI putty SSH or terminal session right click, select paste then Enter to download and run script.

curl -L https://raw.github.com/pageauc/FileBrowser/master/setup.sh | bash

This will download and run the setup.sh script. See Github FileBrowser project

Description

This is sample bash code for a whiptail file browser that allows navigating through a directory a structure. If a file matching the filext variable file type is selected it will Return the filename and path of the selected file. This can be used in your code to do further processing. Note The sample defaults to jpg file extension but this can be customize per your requirements using filext variable.

This Demo whiptail demo can be used in your own bash scripts per the filebrowse.sh example code.

The variables returned from the FileBrowser() function are

Filename : $filename
Directory: $filepath

You can perform commands on

  • Just file name eg. cp $filename $filename.bak
  • Just directory path eg. mv $filepath $filepath_prev
  • Both for full file path eg. rm $filepath/$filename

filebrowse.sh menu

How to Customize

Use nano to edit filebrowse.sh

cd ~/filebrowse
nano filebrowse.sh

Edit the variables below for your requirements

startdir="/home/pi"
filext='jpg'    
menutitle="$filext File Selection Menu"

ctrl-x y to save and exit nano editor

How to Run Demo

To Run demo filebrowse.sh

cd ~/filebrowse
./filebrowse.sh

1 Select Back to navigate to a previous directory.
2 Select a directory entry to navigate to that folder and display list of files/folders.
3 Select a file name that matches the filext variable. If file type is valid
the file name will be returned
4 Use Arrow, page up/dn or tab key to navigate within menu
5 Esc key exits with no selection.

See filebrowse.sh code for more details.

Regards Claude ...

filebrowser's People

Contributors

pageauc avatar phatblinkie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.