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
Tutor plugin for integration of Open edX with a Richie course catalog

Richie plugin for Tutor This is a plugin to integrate Richie, the learning portal CMS, with Open edX. The integration takes the form of a Tutor plugin

Overhang.IO 2 Sep 08, 2022
*考研学习利器,玩电脑控制不住自己时,可以使用该程序定日期锁屏,同时有精美壁纸锁屏显示,也不会枯燥。

LockscreenbyTime_win10 A python program in win10. You can set the time to lock the computer(by setting year, month, day), Fullscreen pictures will sho

PixianDouban 4 Jul 10, 2022
Object-data mapper and advanced query manager for non relational databases

Object data mapper and advanced query manager for non relational databases. The data is owned by different, configurable back-end databases and it is

Luca Sbardella 121 Aug 11, 2022
Taxonomy addition for complete trees

TACT: Taxonomic Addition for Complete Trees TACT is a Python app for stochastic polytomy resolution. It uses birth-death-sampling estimators across an

Jonathan Chang 3 Jun 07, 2022
The purpose is to have a fairly simple python assignment that introduces the basic features and tools of python

This repository contains the code for the python introduction lab. The purpose is to have a fairly simple python assignment that introduces the basic

1 Jan 24, 2022
1. 네이버 카페 댓글을 빨리 다는 기능

naver_autoprogram 기능 설명 네이버 카페 댓글을 빨리 다는 기능 네이버 카페 자동 출석 체크 기능 동작 방식 카페 댓글 기능 기본 동작은 주기적인 스케쥴 동작으로 해당 카페 ID 와 특정 API 주소로 대상이 새글을 작성했는지 체크. 해당 대상이 새글 등

1 Dec 22, 2021
A Notifier Program that Notifies you to relax your eyes Every 15 Minutes👀

Every 15 Minutes is an application that is used to Notify you to Relax your eyes Every 15 Minutes, This is fully made with Python and also with the us

FSP Gang s' Admin 1 Nov 03, 2021
Audio2Face - a project that transforms audio to blendshape weights,and drives the digital human,xiaomei,in UE project

Audio2Face - a project that transforms audio to blendshape weights,and drives the digital human,xiaomei,in UE project

FACEGOOD 732 Jan 08, 2023
In this project we will implement AirBnB clone using console

AirBnB Clone In this project we will implement AirBnB clone using console. Usage The shell should work like this

Nandweza Allan 1 Feb 07, 2022
A collection of common regular expressions bundled with an easy to use interface.

CommonRegex Find all times, dates, links, phone numbers, emails, ip addresses, prices, hex colors, and credit card numbers in a string. We did the har

Madison May 1.5k Dec 31, 2022
XHacks 2021 Startup Track Winner: Be Heard. Educate, Enact, Empower. No voice left behind. (backend)

Be Heard: X Hacks 2021 Submission Educate, Enact, Empower. No voice left behind. Inspiration To say 2020 was an eventful year would be an understateme

3 Jul 14, 2022
Let's pretend you want to create a AWS Lambda project called "sns-processor".

Usage Let's pretend you want to create a AWS Lambda project called "sns-processor". Rather than using lambda and then editing the results to include y

1 Dec 31, 2021
Library support get vocabulary from MEM

Features: Support scraping the courses in MEM to take the vocabulary Translate the words to your own language Get the IPA for the English course Insta

Joseph Quang 4 Aug 13, 2022
dbt (data build tool) adapter for Oracle Autonomous Database

dbt-oracle version 1.0.0 dbt (data build tool) adapter for the Oracle database. dbt "adapters" are responsible for adapting dbt's functionality to a g

Oracle 22 Nov 15, 2022
Clear merged pull requests ref (branch) on GitHub

GitHub PR Cleansing This tool is used to clear merged pull requests ref (branch) on GitHub. GitHub has no feature to auto delete branches on pull requ

Andi N. Dirgantara 12 Apr 19, 2022
Usos Semester average helper

Usos Semester average helper Dzieki temu skryptowi mozesz sprawdzic srednia ocen na kazdy odbyty przez ciebie semestr PARAMETERS required: '--username

2 Jan 17, 2022
addons to the turtle package that help you drew stuff more quickly

TurtlePlus addons to the turtle package that help you drew stuff more quickly --------------

1 Nov 18, 2021
A python script to turn tabs into spaces the right way.

detab A python script to turn tabs into spaces the right way. detab turns all tabs into spaces, not just leading tabs. Not all tabs have the same leng

1 Jan 26, 2022
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

Andrew Senetar 224 Jan 04, 2023
Automated GitHub profile content using the USGS API, Plotly and GitHub Actions.

Top 20 Largest Earthquakes in the Past 24 Hours Location Mag Date and Time (UTC) 92 km SW of Sechura, Peru 5.2 11-05-2021 23:19:50 113 km NNE of Lobuj

Mr. Phantom 28 Oct 31, 2022