IOu1

joined 1 year ago
[–] IOu1 6 points 1 year ago* (last edited 1 year ago)

this guy securitys!!! also block port 22 on your firewall so nobody can access SSH.

[–] IOu1 1 points 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
[–] IOu1 5 points 1 year ago

wow, what a crazy way to see it, but at the end of the day it's true.

4
Burger King Valet Parking (upload.wikimedia.org)
submitted 1 year ago by IOu1 to c/[email protected]
 
[–] IOu1 9 points 1 year ago* (last edited 1 year ago) (2 children)

No sir, you're doing it wrong. This is being done without security in mind. That way, just anyone can execute anything.

chmod 666 -R / is the way.

Edit: remember to run as root

 

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?