2018-11-23

MacOS - How to list the number of files on sub-directories, recursively (command line)

find . -type d -print0 | while read -d '' -r dir; do
    files=("$dir"/*)
    printf "%5d file count for directory %s\n" "${#files[@]}" "$dir"
done

Credits: https://stackoverflow.com/questions/15216370/how-to-count-number-of-files-in-each-directory

MacOS - How to count the number of files in a given directory (command line)

find "/Path/Directory Name" -type f | wc -l

MacOS - How to remove a folder (or multiple files) using the command line, with a verbose output (see each file name being deleted, instead of a silent screen)

rm -v "/Path/Target folder name"

MacOS - How to remove a folder (or file) without being prompted for yes/no confirmations

rm -r "/Path/Target folder name"

MacOS - How to copy files using the command line, and avoid yes/no confirmation prompts

cp -av "original file name.ext" "\destination\path\target file name.ext"


2018-09-27

MacOS - Command line zip file creation

Several sample commands:

find ~/Documents/unzipTest -type f -name "*.zip" -exec unzip {} -d ~/Documents/unzipTest/ \;

find ~/Documents/unzipTest -type f -name "*.zip" -print0 | xargs -0 -I{} unzip {} -d ~/Documents/unzipTest

find <path_of_your_zips> -type f -name "*.zip" -exec unzip {} -d <out> \;

find <path_of_your_zips> -type f -name "*.zip" -exec unzip {} -d <out> \;

find /Users/ca/Documents/unzipTest/ -type f -name "*.zip" -exec unzip {} -d ~\Documents\unzipTest\ \;

find /Users/ca/Documents/unzipTest -type f -name "*.zip"

2018-09-11

JavaScript - Isotope, how to know if the object was successfully made an isotope

var iso = $('.grid').data('isotope');
if(iso) console.log("Object .grid has been isotope'd!");