Uproot - A script to bring deeply nested files or directories to the surface

Related tags

Miscellaneousuproot
Overview

UPROOT

Uproot Icon

Bring deeply nested files or folders to the surface

Uproot demo

Uproot helps convert a directory structure like this:

.
└── tv_series_season_1
    ├── tv_series_season_1_episode1
    │   ├── tv_series_season_1_episode1.mkv
    │   └── tv_series_season_1_episode1.srt
    ├── tv_series_season_1_episode2
    │   ├── tv_series_season_1_episode2.mkv
    │   └── tv_series_season_1_episode2.srt
    ├── tv_series_season_1_episode3
    │   ├── tv_series_season_1_episode3.mkv
    │   └── tv_series_season_1_episode3.srt
    ├── tv_series_season_1_episode4
    │   ├── tv_series_season_1_episode4.mkv
    │   └── tv_series_season_1_episode4.srt
    └── tv_series_season_1_episode5
        ├── tv_series_season_1_episode5.mkv
        └── tv_series_season_1_episode5.srt

to this:

tv_series_season_1
├── tv_series_season_1_episode1.mkv
├── tv_series_season_1_episode1.srt
├── tv_series_season_1_episode2.mkv
├── tv_series_season_1_episode2.srt
├── tv_series_season_1_episode3.mkv
├── tv_series_season_1_episode3.srt
├── tv_series_season_1_episode4.mkv
├── tv_series_season_1_episode4.srt
├── tv_series_season_1_episode5.mkv
└── tv_series_season_1_episode5.srt

Installation

There are several ways of installing the script, but currently I have only tested on Linux.

Windows and Mac OS

If you are on Windows or Mac OS, you will need to first install python. Once you have python installed
you can download the zip file and extract it to your preferred location.

Linux

On Arch Linux, you can install Uproot through the AUR:

yay -S uproot-git

Other Linux distro users can run the following command:

sudo -fLo /usr/bin/uproot --create-dirs \
https://raw.githubusercontent.com/keystroke3/uproot/main/uproot.py &&
sudo chmod +x /usr/bin/uproot

Usage

NOTE: There is currently no way of reversing the actions of uproot. Use with caution.

If you are on Linux, you can quickly use uproot from anywhere in your terminal by running:

uproot <source_foulder>

If you are on Windows or Mac OS, the same can be achieved by running

python uproot.py <source_folder>

in the directory where you unzipped your files.
For example:

uproot tv_series_season_1

will have the same results as shown above. If we are already in the desired folder, we can replace the folder name with a dot (.)

All the other options can be shown by running

uproot -h

The out put will be something like this:

usage: uproot [-h] [-s SOURCE] [-o OUTPUT] [-O MAKE_OUTPUT] [-r] [-R] [-c] [-v] [-d]

This is a simple program for recursively moving files from subdirectories to the current or specified directory

options:
  -h, --help            show this help message and exit
  -s SOURCE, --source SOURCE
                        The folder to perform moving operations on. Defaults to the current directory not specified
  -o OUTPUT, --output OUTPUT
                        The folder to move files to. Defaults to the root of the starting directory or current directory. This has to be outside the source directory
  -O MAKE_OUTPUT, --make_output MAKE_OUTPUT
                        Same as --output but creates the output directory if specified one does not exist.
  -r, --remove_empty    Specifies if the empty directories should be cleared after moving. Defaults to false if this flag is not set.
  -R, --remove_empty_source
                        same as --remove_empty but also removes the source directory itself.
  -c, --copy            Copy files to destination instead of moving
  -v, --verbose         Prints the current operations.
  -d, --directories     Operates on the directories at the bottom of the file tree instead of files

These options can be chained together for example:

uproot -s tv_series_season_1 -vRO ../tv_series_season_1_with_subs

This command will result in the following series of operations:

  • the files in tv_series_season_1 and uproot them to a directory tv_series_season_1_with_subs in the parent directory relative to the current one.
  • If the output directory doesn't exist, it will create it, because of -O instead of -o flag.
  • After that, it will remove all the empty directories in tv_series_season_1 and if the source directory is left empty, it will removed it as well, because of -R instead of -r flag.

Contribution

This is a hobby project, so bugs can be expected. If you encounter any bugs, feel free to create an issue and make sure to leave as much detail as possible to come up with a solution.
If you own a Windows or Mac OS machine, you could create executables and installation instructions for those platforms. If you do, please create a pull request.
A GUI will also be nice so people don't have to use a terminal for to run the script.
Do you have any more things you can add to the program, fork it, fix it add it and create a pull request.

Donation

If you like the project and would like to support me for some reason: PayPal me: [email protected]

Owner
Ted
Full stack web developer
Ted
An example repository for how to generate results using PyBaMM

PyBaMM results This repository provides a template for generating results (for example, for a paper) using PyBaMM Installation Install PyBaMM using a

PyBaMM Team 7 Oct 09, 2022
Utils to quickly evaluate many 🤗 models on the GLUE tasks

Utils to quickly evaluate many 🤗 models on the GLUE tasks

Przemyslaw K. Joniak 1 Dec 22, 2021
freeCodeCamp Scientific Computing with Python Project for Certification.

Time_Calculator_freeCodeCamp freeCodeCamp Scientific Computing with Python Project for Certification. Write a function named add_time that takes in tw

Rajdeep Mondal 1 Dec 23, 2021
Simplest way to find Appointments in Bürgeramt Berlin, Not over engineered.

Simplest way to find Appointments in Bürgeramt Berlin, Not over engineered. Der einfachste Weg, Termine im Bürgeramt Berlin zu finden, ohne viel Schnickschnack.

Jannis 8 Nov 25, 2022
Howell County, Missouri, COVID-19 data and (unofficial) estimates

COVID-19 in Howell County, Missouri This repository contains the daily data files used to generate my COVID-19 dashboard for Howell County, Missouri,

Jonathan Thornton 0 Jun 18, 2022
Simple python code for compile brainfuck program.

py-brainf*ck Just a basic compiled that compiles your brainf*ck codes and gives you informations about memory, used cells, dumped version, logs etc...

4 Jun 13, 2021
Identify and annotate mutations from genome editing assays.

CRISPR-detector Here we propose our CRISPR-detector to facilitate the CRISPR-edited amplicon and whole genome sequencing data analysis, with functions

hlcas 2 Feb 20, 2022
Function Plotter✨

Function-Plotter Build With : Python PyQt5 unittest matplotlib Getting Started This is an list of needed instructions to set up your project locally,

Ahmed Lotfy 3 Jan 06, 2022
Welcome to my pod transcript search webb app!

pod_transcript_search Welcome to the pod transcript search webb app! Tech stack used: Languages used: Python (for the back-end), JavaScript (for the f

3 Feb 04, 2022
A python trivium implemention

A python trivium implemention

tnt2402 1 Nov 12, 2021
Pygments is a generic syntax highlighter written in Python

Welcome to Pygments This is the source of Pygments. It is a generic syntax highlighter written in Python that supports over 500 languages and text for

1.2k Jan 06, 2023
List of short Codeforces problems with a statement of 1000 characters or less. Python script and data files included.

Shortest problems on Codeforces List of Codeforces problems with a short problem statement of 1000 characters or less. Sorted for each rating level. B

32 Dec 24, 2022
Perform oocyst segmentation in mercurochrome stained mosquito midgut

Midgut_oocyst_segmentation Perform oocyst segmentation in mercurochrome stained mosquito midguts This oocyst segmentation model also powers the webtoo

Duo Peng 3 Oct 27, 2021
A module that can manage you're gtps

Growtopia Private Server Controler Module For Controle Your GTPS | Build in Python3 Creator Information

iFanpS 6 Jan 14, 2022
🐍 A Python lib for (de)serializing Python objects to/from JSON

Turn Python objects into dicts or (json)strings and back No changes required to your objects Easily customizable and extendable Works with dataclasses

Ramon Hagenaars 253 Dec 14, 2022
An OrpheusDL Tidal module

OrpheusDL - Tidal A Tidal module for the OrpheusDL modular archival music program Report Bug · Request Feature Table of content About OrpheusDL - Tida

Daniel 54 Dec 29, 2022
Helps compare between New and Old Tax Regime.

Income-Tax-Calculator Helps compare between New and Old Tax Regime. Sample Console Input/Output

2 Jan 10, 2022
A repository of study materials related to Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: https://greenteapress.com/wp/think-python-2e/

Intro-To-Python This content is based on the book Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: http

Brent Eskridge 63 Jan 07, 2023
A project for the Qvault Hackathon, 2022-01-17

musical-octo-engine Steps to run brew install python-tk brew install portaudio

Erik Kristofer Anderson 2 May 17, 2022
Alternative StdLib for Nim for Python targets

Alternative StdLib for Nim for Python targets, hijacks Python StdLib for Nim

Juan Carlos 100 Jan 01, 2023