Files
2023-10-01 00:01:37 +01:00
..
2023-10-01 00:01:37 +01:00
2023-09-20 22:16:44 +01:00
2023-10-01 00:01:37 +01:00

# Find all files in the current directory and its subdirectories, and list only the file extensions, sorted uniquely.
find . -type f | sed 's/.*\.//' | sort -u
# Find all XML files in the current directory and its subdirectories.
find . -type f -name "*.xml"
# Count the number of XML files in the current directory and its subdirectories.
find . -type f -name "*.xml" | wc -l
# Count the number of M4A audio files in the current directory and its subdirectories.
find . -type f -name "*.m4a" | wc -l
# Find all XML files in the current directory and its subdirectories, then filter those that have a pattern like '_[0-9][a-zA-Z].xml' at the end, sort them, and list them uniquely.
find . -type f -name '*.xml' | grep -Eo '_[0-9][a-zA-Z]\.xml$' | sort | uniq
# Find all files named "song.json" in the current directory and its subdirectories, and remove them.
find . -type f -name "song.json" -exec rm -f {} \;
# remove 10 seconds from all m4as and convert to ogg files
find . -type f -name "*.m4a" -exec sh -c 'DURATION=$(ffprobe -i "$0" -show_entries format=duration -v quiet -of csv="p=0"); TRIM_TIME=$(awk "BEGIN {print $DURATION - 10}"); ffmpeg -y -ss 0 -t $TRIM_TIME -i "$0" "${0%.m4a}.ogg"' {} \;
#!/bin/bash
find . -type f -name "*.2dx" -exec sh -c '
  dir=$(dirname "$0")
  filename=$(basename "$0")
  file_without_extension="${filename%.*}"

  if echo "$filename" | grep -qE "clip|pre"; then
    echo "Skipping $filename"
    exit 0
  fi

  cd "$dir" || exit 1
  2dxdump "$filename"
  ffmpeg -y -i "0.wav" "${file_without_extension}clip1.ogg"
' {} \;
find . -type f -name "1.wav" -exec rm -f {} \;
#!/bin/bash
find . -type f -name "*.s3p" -exec sh -c '
  dir=$(dirname "$0")
  filename=$(basename "$0")
  file_without_extension="${filename%.*}"

  output_file="${file_without_extension}clip1.ogg"

  if echo "$filename" | grep -qE "clip|pre"; then
    echo "Skipping $filename"
    exit 0
  fi

  cd "$dir" || exit 1
  if [ -f "$output_file" ]; then
    echo "Skipping as $output_file already exists."
    exit 0
  fi

  # uhh yea deal with it lol
  ../../../../../.venv/Scripts/python ../../../../../s3p_unpack.py --input "$filename"
  ffmpeg -y -i "0.wma" "$output_file"
' {} \;