November 13, 2025Nov 13 Add a button / right click command in the File Manager to easily extract .zip etc in situ. Go alias shortcut# extract ZIP to auto-named subfolderecho "extract() { unzip \\\"\\\$1\\\" -d \\\"\\\${1%.*}/\\\"; }" >> /etc/profilecommand```extract() { unzip "$1" -d "${1%.*}/" }```command in folder```unzip "filename.zip" -d "${filename.zip%.*}/"```command not in folder```unzip "/mnt/user/downloads/movie.zip" -d "$(dirname /mnt/user/downloads/movie.zip)/${movie.zip##*/%.*}/"``` Edited November 13, 2025Nov 13 by dopeytree
November 13, 2025Nov 13 Author Thanks yeah the gui sucks butt (slow manual browsing etc) but maybe the undying 7zip package is good.Much easier to terminal to the folder and type extract. Got grok it help me write these. Insert into go file for persistency.```# extract ZIP/RAR to auto-named subfolder, move to .tmp_zip/, log to extract_log.txtgrep -q "extract() {" /etc/profile || echo "extract() { local ext=\\\"\\\${1##*.}\\\"; local folder=\\\"\\\${1%.*}\\\"; local log_file=\\\"extract_log.txt\\\"; local timestamp=\\\$(date \\\'+%Y-%m-%d %H:%M:%S\\\'); local moved=0; echo \\\"\\\$timestamp: Starting extract: \\\$1\\\" >> \\\"\\\$log_file\\\"; if [[ \\\"\\\$ext\\\" == \\\"zip\\\" ]]; then if unzip -o \\\"\\\$1\\\" -d \\\"\\\$folder/\\\"; then moved=1; echo \\\"\\\$timestamp: SUCCESS - Extracted \\\$1 to \\\$folder/ and moved to .tmp_zip/\\\" >> \\\"\\\$log_file\\\"; else echo \\\"\\\$timestamp: ERROR - Failed to extract \\\$1 (ZIP)\\\" >> \\\"\\\$log_file\\\"; return 1; fi; elif [[ \\\"\\\$ext\\\" == \\\"rar\\\" ]]; then if unrar x -o+ \\\"\\\$1\\\" \\\"\\\$folder/\\\"; then moved=1; echo \\\"\\\$timestamp: SUCCESS - Extracted \\\$1 to \\\$folder/ and moved to .tmp_zip/\\\" >> \\\"\\\$log_file\\\"; else echo \\\"\\\$timestamp: ERROR - Failed to extract \\\$1 (RAR)\\\" >> \\\"\\\$log_file\\\"; return 1; fi; else echo \\\"\\\$timestamp: SKIP - Unsupported format for \\\$1 (\\\$ext)\\\" >> \\\"\\\$log_file\\\"; return 1; fi; if [[ \\\$moved -eq 1 ]]; then mkdir -p .tmp_zip; mv \\\"\\\$1\\\" .tmp_zip/; fi; }" >> /etc/profile``````# batch extract all ZIP/RAR recursively (newest first), exclude .tmp_zip/, log to extract_log.txtgrep -q "batch_extract() {" /etc/profile || echo "batch_extract() { local log_file=\\\"extract_log.txt\\\"; local timestamp=\\\$(date \\\'+%Y-%m-%d %H:%M:%S\\\'); local count=0; echo \\\"\\\$timestamp: BATCH START - Recursive extract of all ZIP/RAR (excluding .tmp_zip/)\\\" >> \\\"\\\$log_file\\\"; while IFS= read -r -d \\\"\\\" f; do echo \\\"Processing: \\\$f\\\"; if extract \\\"\\\$f\\\"; then ((count++)); fi; done < <(find . -type f \\$$ -name \\\"*\\\\.zip\\\" -o -name \\\"*\\\\.rar\\\" \\ $$ ! -path \\\"*/.tmp_zip/*\\\" -printf \\\'%T@ %p\\\\n\\\' | sort -nr | cut -d\\\' \\\' -f2- | tr \\\'\\\\n\\\' \\\'\\\\0\\\'); echo \\\"\\\$timestamp: BATCH END - Processed \\\$count archives total\\\" >> \\\"\\\$log_file\\\"; echo \\\"Batch complete! Processed \\\$count archives across subfolders. Check .tmp_zip/ folders for originals and extract_log.txt for details.\\\"; }" >> /etc/profile``` Edited November 13, 2025Nov 13 by dopeytree
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.