1 vote
Accepted

Delete all folders except if they have a specific file type in Linux

This seems to work well (EDIT: only if it has a single pdf file): for d in */; do if ! [ -f $d/*.pdf ]; then echo "Will remove $d" fi done (-f looks for a file at the specified ...
1 vote

Delete all folders except if they have a specific file type in Linux

The following command prints pathnames of directiories about to be deleted: # cd to the right directory first find . -type d ! -name . \( -exec [ -r {} ] \; -o ! -prune \) \ -exec sh -c ' set -- &...
1 vote

How to merge ls commands colors with the output of find or du?

Combining some of the above answers with oh-my-zshell on a Mac provided me sizes, colorized directory names and plain text file names sorted to output the 10 largest files/directories: paste <(du -...

Only top scored, non community-wiki answers of a minimum length are eligible