I wrote a script that manages the files of GoPro footage, thumbnails and the low resolution copy of the video files. It asks for the footage directory and has the option to rename all files equally so they can be selected, separated, or processed easier, or move all the low resolution copies into another folder in the same directory.

Besides posting it on GitHub is there anywhere else I can upload it or share it?

  • sneakyninjapants
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Depending on how long it is you could just post it inline with three backticks (`) before and after the code. That’s markdown for a code block.

    Example:

    #!/bin/bash
    echo "This is code block"
    echo "notice everything is monospaced"
    
    while true; do
        some example of indentation
    done
    
  • IOu1OP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I guess I’ll post it here then:

    #!/bin/bash
    
    # Function to display the menu
    display_menu() {
      echo "Select an option:"
      echo "1. Move all .LRV files to 'LRV' directory"
      echo "2. Undo move operation"
      echo "3. Rename files starting with 'GL' to 'GX'"
      echo "4. Undo renaming operation for .LRV files"
      echo "5. Exit"
      read -p "Enter choice (1, 2, 3, 4, or 5): " choice
    }
    
    # Function to handle option 1
    move_lrv_files() {
      # Create the LRV directory
      mkdir "LRV"
    
      # Move all the .LRV files to the LRV directory
      mv *.LRV "LRV"
      echo "Moved all .LRV files to 'LRV' directory"
    }
    
    # Function to handle option 2
    undo_move_operation() {
      # Move all .LRV files back to the working directory
      mv LRV/*.LRV .
    
      # Remove the LRV directory
      rmdir LRV
      echo "Undid move operation"
    }
    
    # Function to handle option 3
    rename_files() {
      # Rename files starting with 'GL' to 'GX'
      for file in GL*; do
        newname="${file/GL/GX}"
        mv "$file" "$newname"
        echo "Renamed file '$file' to '$newname'"
      done
    }
    
    # Function to handle option 4
    undo_rename_files() {
      # Undo renaming operation for .LRV files (revert files from 'GX' to 'GL')
      for file in GX*.LRV; do
        newname="${file/GX/GL}"
        mv "$file" "$newname"
        echo "Renamed file '$file' to '$newname'"
      done
    }
    
    # Main script
    if [[ $1 == "-d" ]]; then
      # Use directory provided as command-line argument
      directory=$2
    else
      # Ask user for the working directory
      read -p "Please enter the path of the working directory: " directory
    fi
    
    # Change the working directory and check if it was successful
    if cd "$directory"; then
      while true; do
        display_menu
    
        # Check user choice and execute the appropriate function
        case $choice in
          1)
            move_lrv_files
            ;;
          2)
            undo_move_operation
            ;;
          3)
            rename_files
            ;;
          4)
            undo_rename_files
            ;;
          5)
            echo "Exiting..."
            break
            ;;
          *)
            echo "Invalid choice"
            ;;
        esac
    
        echo
      done
    else
      # Error message if cd command fails
      echo "Error: Invalid path. Please double check the working directory."
    fi
    
  • narshee@iusearchlinux.fyi
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    For single file scripts you can use gist, some online note sharing website or if it is short paste it directly in a post or comment