Category: Linux

Recursive unrar into each folder…

I’m not sure why this was so hard to find, but now it’s working… I was initially working on having “find” -exec UnRAR but it didn’t seem to work too well (I couldn’t find a good one-liner to separate file directory and full-filename to put into the find -exec command, if you have one, let me know).

#!/bin/bash
find $PWD -type f -name '*.rar' -print0 | 
while IFS= read -r -d '' file; do
dir=$(dirname "$file")
	unrar e -o+ "$file" "$dir"/ 
done

(some parts of the script was inspired from other online sources)

That oneliner…

Once again, this is just so that I don’t forget 🙂

apt -y update && apt -y upgrade && apt -y dist-upgrade && apt -y autoremove && apt -y clean && apt -y purge && reboot

Because you just want keep your system updated … I’m sure some of the commands are redundant, but hey.. It works!

Remove files with Find

Try to remember that the syntax to remove files recursively using Find is:

find . -name "Thumbs.db" -exec rm '{}' \;