Skip to content
forked from dyne/harvest

Tool to sort large collections of files according to common typologies

License

Notifications You must be signed in to change notification settings

g-gundam/harvest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harvest - manage large collections of files and dirs

Harvest makes it easy to list files and folders by type and copy or move them around.

Kant handle my swag

It is compact and portable software that can scan files and folders to recognise their typology. Scanning is based on file extensions and a simple fuzzy logic analysis of folder contents (not just files) to recognise if they are related to video, audio or text materials, etc.

It is fast: it can process approximately 1GB of stored files per second and is operated from the console terminal.

Harvest operates on folders containing files without exploding the files around: it assesses the typology of a folder from the files contained, but does not move the files outside of that folder. For instance it works very well to move around large collections of downloaded torrent folders.

💾 Installation

Harvest works on all desktop platforms supported by it (GNU/Linux, Apple/OSX and MS/Windows).

To be built from source, Harvest requires the following packages to be installed in your system:

  • pkg-config
  • luarocks
  • libluajit-5.1-dev

Then inside the luarocks package manager it should be installed luastatic and inspect:

sudo luarocks install luastatic
sudo luarocks install inspect

From inside the source, just type:

Just type

git submodule update --init --recursive
make
sudo make install

to install into /usr/local/bin/harvest.

🎮 Usage

Usage: harvest [OPTIONS]

OPTIONS: 
  -p, --path=PATH     (default is current position)
  -t, --type=TYPE     text, audio, video, code, etc.
  -o, --output=FORMAT csv, json (default: human)
  --dir               select only directories
  --file              select only files
  -d                  run in DEBUG mode
  -v, --version       print the version and exits

To list all image files found in Downloads:

harvest -p ~/Downloads -t image --file

To list all video directories at current filesystem position:

harvest -t video --dir

To list all files and dirs containing reading materials:

harvest -t text

To have a list of supported types use harvest -t list at any moment

Supported types:
 code image video book text font web archiv sheet exec slide audio

For more information about types recognized see the catalogue of file types we maintain in the file-extension-list project.

Copy or move

So far we have seen how to run non-destructive operations, now we come to apply actual changes to the filesystem.

Using shell scripts

Another simplier solution to move or copy files around is to use shell scripting on the command-line or inside your own scripts.

For example, here is a short concatenation of commands that will copy all harvested image files and directories to /tmp/images/

harvest -t image -o csv | cut -d, -f5 | xargs -I{} cp -v {} /tmp/images

The comma separated list (CSV) output of harvest is organized like this:

FILE | DIR, TYPE, TIMESTAMP, SIZE, FILENAME

Using hvst

One solution is to use a practical wrapper called hvst which supports distributing files to destination folders named after Perl expressions based on file attributes, for instance date.

For more info about this solution see the hvst readme documentation.

Using TMSU

Support of tagged filesystems is an old feature present in the harvest shell implementation and it is easy to bring back.

If anyone wants it back just say, for more information see the TMSU project.

😍 Acknowledgements

software by Dyne.org

Harvest is Copyright (C) 2014-2022 by the Dyne.org Foundation

Harvest is designed, written and maintained by Denis "Jaromil" Roio with contributions by Puria Nafisi Azizi and G Gundam.

This source code is free software; you can redistribute it and/or modify it under the terms of the GNU Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This source code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer to the GNU Public License for more details.

You should have received a copy of the GNU Public License along with this source code; if not, write to: Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

About

Tool to sort large collections of files according to common typologies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 53.2%
  • C 27.1%
  • Shell 11.5%
  • Perl 5.3%
  • Makefile 2.9%