Gpg, multiple files encryption

Hi, there!
Could you please tell me how to encrypt multiple files(e.g. every file in some folder) without compressing them into one archive?
It seems there is not such option is gpg…

Hi @dwind, and welcome!

I suggest you look into the find command.

man find

You could use it to find files where ever, according to criteria, and then use the -exec flag to run a command for each result.

So you could do something like this (in pseudocode):

find /in/some/directory -type file -name '*containing.something*' -exec `compress {}` \;

Hope you manage!

2 Likes

GnuPG can’t encrypt multiple files. It can only encrypt one file. You can create an archive, for example a tar archive (which is not compressed) and encrypt it.
Or you encrypt every file in a folder, for example with a loop over every file. Either with a for loop in your shell or like @Mirdarthos examples with find.

1 Like

this is what your shell is for

@xabbu what is loop? I use KDE.

It is a function in shells that can run a command multiple times, for example a “for loop” in bash over all files that end in .txt

for file in *.txt; do echo $file; done

Will echo the filename for every file that ends in .txt in the current folder.

You might want to search the internet for a more complete tutorial on loops in Shells.

1 Like

Thank you very much! This also works perfectly. :+1:

1 Like

Since you’re using KDE, why not use Plasma Vault? It sounds like it does exactly what you’re looking for.

The package is named: plasma-vault

1 Like

Thank you for the hint. Never heard of it before. I’ll investigate the possibility of using it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.