I agree, But I am old and wont change the world, I can only improve it. So I use AI to create things I need to save me time (I am one man and try to achieve so much), so the fact AI can code what I need better/less buggy and MUCH faster than I is worth me using it, But if I was wanting to learn to do everything from memory and understand I still do things manually when I am learning, but even then to understand if it is the "best" way to get results, sometimes AI give a few ideas than you originally had or build upon it.
Relying on AI to achieve results is stupid if you don't understand why the results it gives is so damn impressive, I looked through the code and learnt some stuff and seen it's methods. it was MUCH cleaner than I could do, but I understood it. Now if I wasn't already a script coder and wanted to use AI to do it, that's a bad use case, because you can't tell when it's doing something totally wrong.
But the lack of learning for yourself will limit you and the lack of trying your own solutions first, means that AI can't learn from you, your contributions may never progress AI beyond it's current level if we all used it all the time for everything. everything would have a sameness to it. So I only use it to save time, instead of extracting a archive, opening a file, editing the file, saving and re archiving, I automated it - saved me many hours, I figure my time will be better spent using AI to help me automate it, it took me less than 15 minutes and the job it did took a little under 40 minutes to complete.
Here is the code, it's great that it uses things I know, things I don't and things I wish I knew, I can learn from reading this codes output and even use AI and ask what it's doing on certain sections, because it can elaborate so well. AI is just a tool, you need to choose when to use it and how:
Code:
#!/bin/bash
# Nemo script:
# Update InstalledSize= for ALL metadata files found.
#
# Rules:
# - Only modify files that contain a [Meta] section.
# - Prefer archive size (without extracting):
# LLGame.tar.gz
# LLApp.tar.gz
# ppGame.7z
# ppApp.7z
# - If no matching archive is found:
# Use the total size of the folder and all subfolders (in KB).
# - InstalledSize= is always written inside the [Meta] section.
# - No .bak files are created, files are overwritten directly.
#
# Supported metadata:
# LLGame.llg
# LLApp.lla
# ppGame.ppg
# ppApp.app
# ssApp.app
IFS=$'\n'
# Get uncompressed size from archive without extracting
get_size_from_archive() {
local archive="$1"
local total_bytes=0
case "$archive" in
*.tar.gz)
while read -r size; do
total_bytes=$((total_bytes + size))
done < <(tar -tvzf "$archive" | awk '{print $3}')
;;
*.7z)
while read -r size; do
total_bytes=$((total_bytes + size))
done < <(7z l "$archive" | awk '
/^-------------------/ {p=!p; next}
p && $1 ~ /^[0-9]/ {print $4}
')
;;
*)
return 1
;;
esac
# Bytes → KB (round up)
echo $(( (total_bytes + 1023) / 1024 ))
}
# Get size of directory + subdirectories in KB
get_size_from_folder() {
local folder="$1"
du -sk "$folder" | cut -f1
}
update_file() {
local file="$1"
local dir archive size_kb tmpfile
# Skip if no [Meta] section
if ! grep -q '^\[Meta\]' "$file"; then
echo "Skipping (no [Meta]): $file"
return
fi
dir=$(dirname "$file")
# Match metadata file to its archive
case "$(basename "$file")" in
LLGame.llg) archive="$dir/LLGame.tar.gz" ;;
LLApp.lla) archive="$dir/LLApp.tar.gz" ;;
ppGame.ppg) archive="$dir/ppGame.7z" ;;
ppApp.app) archive="$dir/ppApp.7z" ;;
ssApp.app) archive="$dir/ppApp.7z" ;; # adjust if ssApp gets its own archive later
*) return ;;
esac
# Try archive first, fallback to folder size
if [ -f "$archive" ]; then
size_kb=$(get_size_from_archive "$archive")
echo "Using archive for $file → $archive"
else
size_kb=$(get_size_from_folder "$dir")
echo "Archive not found, using folder size for $file"
fi
if [ -z "$size_kb" ]; then
echo "Failed to calculate InstalledSize for: $file"
return
fi
echo "Updating $file → InstalledSize=$size_kb KB"
tmpfile=$(mktemp)
# Rewrite file ensuring InstalledSize is inside [Meta]
awk -v size="$size_kb" '
BEGIN {
in_meta=0
installed_written=0
}
/^\[Meta\]/ {
print
in_meta=1
next
}
/^\[.*\]/ {
if (in_meta && !installed_written) {
print "InstalledSize=" size
installed_written=1
}
in_meta=0
print
next
}
{
if (in_meta && $0 ~ /^InstalledSize=/) {
print "InstalledSize=" size
installed_written=1
next
}
print
}
END {
if (in_meta && !installed_written) {
print "InstalledSize=" size
}
}
' "$file" > "$tmpfile"
mv "$tmpfile" "$file"
}
for item in $NEMO_SCRIPT_SELECTED_FILE_PATHS; do
[ -d "$item" ] || continue
find "$item" -type f \( \
-name "LLGame.llg" -o \
-name "LLApp.lla" -o \
-name "ppGame.ppg" -o \
-name "ppApp.app" -o \
-name "ssApp.app" \
\) | while read -r file; do
update_file "$file"
done
done
echo "InstalledSize update complete:"
echo " - Used archive sizes when available"
echo " - Fell back to folder sizes when archives were missing"
echo " - Only files with [Meta] were modified"