Code Monkey home page Code Monkey logo

organise_folders's Introduction

Folder organisers

Required: Define path before running

1) new_folder

This script creates a new folder in a given path and/or sorts folders prefixed with numbers and ensures new folders follow the sequence.

# Define the base path where folders are to be managed.
path = "./path/to/directory"

Usage:

python3 new_folder.py folder_name [sub_directory_name]
folder_name 
    - Required. 
    - Name of the new folder to create.

sub_directory_name
    - Optional. 
    - The subdirectory under the main path where the folder will be created.

2) reindex_folders

This script creates a folders in the path you provided.

# Define the base path where folders are to be managed.
path = "./path/to/directory"

Usage:

python3 reindex_folders.py

Step up and exec

For both scripts intial step:

  1. Make the Script Executable:
    • Open a terminal.
    • Navigate to the directory where you saved this script.
    • Run the command:
    chmod +x new_folder.py
    
    chmod +x reindex_folders.py
    
    This command makes the script executable.

Note: The scripts are now executabble from within the directory. Should you want to call the scripts from anywhere, go to correscopnding set 2.

  1. Place the Script in Your PATH for Easy Access:

    • Use echo $PATH in the terminal to view directories in your PATH variable.
    • Move the script to a directory in your PATH, commonly ~/bin for Linux/macOS users: mv new_folder.py ~/bin/ or mv reindex_folders.py ~/bin/
    • If ~/bin isn't in your PATH or you've chosen another directory, add it by appending export PATH="$HOME/bin:$PATH" to your .bashrc, .bash_profile, .zshrc, or equivalent.
    • Apply changes: source ~/.bashrc (or corresponding file).
  2. Once the script is in your PATH and marked as executable, you can run it from any directory by simply typing:

    python3 new_folder.py
    
    python3 reindex_folders.py
    

Notes:

  • This guide assumes a Unix-like operating system (Linux/macOS). Windows users may need to adjust these instructions based on their environment.
  • Ensure you have the necessary permissions to write to the target directory.

organise_folders's People

Contributors

kailana-so avatar

Watchers

 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.