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

Related tags

Miscellaneous uproot
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]

You might also like...
Script to produce `.tex` files of example GAP sessions

Introduction The main file GapToTex.py in this directory is used to produce .tex files of example GAP sessions. Instructions Run python GapToTex.py [G

This Python script can enumerate all URLs present in robots.txt files, and test whether they can be accessed or not.
This Python script can enumerate all URLs present in robots.txt files, and test whether they can be accessed or not.

Robots.txt tester With this script, you can enumerate all URLs present in robots.txt files, and test whether you can access them or not. Setup Clone t

A python script for compiling and executing .cc files

Debug And Run A python script for compiling and executing .cc files Example dbrun fname.cc [DEBUG MODE] Compiling fname.cc with C++17 ------------

A python script to decrypt media files encrypted using the Android application 'Secret Calculator Photo Vault'. Supports brute force of PIN also.

A python script to decrypt media files encrypted using the Android application 'Secret Calculator Photo Vault'. Supports brute force of PIN also.

A script to download all the challenges and files from the CTFd instance.

Python CTFd Downloader A script to download all the challenges and files from the CTFd instance. Installation Clone this repo: git clone https://githu

Python script to commit to your github for a perfect commit streak. This is purely for education purposes, please don't use this script to do bad stuff.

Daily-Git-Commit Commit to repo every day for the perfect commit streak Requirments pip install -r requirements.txt Setup Download this repository. Cr

A script where you execute a script that generates a base project for your gdextension

GDExtension Project Creator this is a script (currently only for linux) where you execute a script that generates a base project for your gdextension,

This bot uploads telegram files to MixDrop.co,File.io.

What is about this bot ? This bot uploads telegram files to MixDrop.co, File.io. Usage: Send any file, and the bot will upload it to MixDrop.co, File.

Python library to natively send files to Trash (or Recycle bin) on all platforms.

Send2Trash -- Send files to trash on all platforms Send2Trash is a small package that sends files to the Trash (or Recycle Bin) natively and on all pl

Owner
Ted
Full stack web developer
Ted
Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV

BaT Data Grabber Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV Bri

Elliot Weil 2 Oct 31, 2021
An account generator for guilded.gg that I made a while back and decided to bring back up

An account generator for guilded.gg that I made a while back and decided to bring back up

null 8 Nov 17, 2022
A Python Perforce package that doesn't bring in any other packages to work.

P4CMD ?? A Python Perforce package that doesn't bring in any other packages to work. Relies on p4cli installed on the system. p4cmd The p4cmd module h

Niels Vaes 13 Dec 19, 2022
ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep (rg) ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will resp

Andrew Gallant 35k Dec 31, 2022
A small site to list shared directories

Nebula Server Directories This site can be used to list folder and subdirectories in your server : Python It's required to have Python 3.8 or more ins

Adrien J. 1 Dec 28, 2021
A tool to quickly create codeforces contest directories with templates.

Codeforces Template Tool I created this tool to help me quickly set up codeforces contests/singular problems with templates. Tested for windows, shoul

null 1 Jun 2, 2022
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022
Islam - This is a simple python script.In this script I have written all the suras of Al Quran. As a result, by using this script, you can know the number of any sura at the moment.

Introduction: If you want to know sura number of al quran by just typing the name of sura than you can use this script. Usage in termux: $ pkg install

Fazle Rabbi 1 Jan 2, 2022
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

null 32 Dec 24, 2022
An OBS script to fuze files together

OBS TEXT FUZE Fuze text files and inject the output into a text source. The Index file directory should be a list of file directorys for the text file

SuperZooper3 1 Dec 27, 2021