I can use:
for f in .* ; do [ -f $f ] && openssl aes-256-cbc -in $f -out $f -k PASSWORD ; done
to encrypt all hidden files in a folder and use:
for f in * ; do [ -f $f ] && openssl aes-256-cbc -in $f -out $f -k PASSWORD ; done
to encrypt all visible files in a folder. Is it possible to combine these two commands? And are there other potential types of files that are not matched by * and .*?
*isn't recursive. You'd need something like bash'sglobstar(**). Or just usefind.find? I also realized it isn't recursive but I am not sure how to use find with openssl particularly I don't know how to get$ffrom the original command.find . -type f -exec openssl aes-256-cbc -in {} -out {} -k PASSWORD \;I'd expect. Though I am not certain writing to the same file works well withopenssl. I think it truncates the output file immediately, so it will read from an empty file."$f"instead of$f)