Specify path for output file?

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
Post Reply
shet
Posts: 3
Joined: Sun Oct 07, 2012 10:08 am

Specify path for output file?

Post by shet »

Sorry to ask such a basic question, but is it actually possible to specify a path for the output file that is different from the input file? It seems that if I specify a path after -o that it is ignored and that the output file is still placed next to the input file.

Code: Select all

aescrypt -e -p apple -i /path/to/inputfile -o path/to/desired/outputfile
User avatar
paulej
Posts: 593
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Specify path for output file?

Post by paulej »

This syntax works for me:

Code: Select all

aescrypt -e -p apple -o /path/to/output /path/to/input
Note there is no -i parameter. The input filename is just placed at the end. What version of aescrypt are you using? I tested the above on Linux, but perhaps there is a bug in another platform?
shet
Posts: 3
Joined: Sun Oct 07, 2012 10:08 am

Re: Specify path for output file?

Post by shet »

I was indeed using the incorrect format!
I am not particularly command line savvy. I am using the Mac OS X command line version to try to write a basic shell script (my first one)! that encrypts the content of a folder and places the output into a different folder.

I would seem that we must specify exact filenames rather than wildcards or a directory for both the input and output files. So, what would be the output syntax when specifying multiple input files? Ideally I would just point to the desired directories but that does not seem to be possible.
User avatar
paulej
Posts: 593
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Specify path for output file?

Post by paulej »

The Apple command-line tool is exactly the same as Linux. What I do not personally know is what shell options you have on Apple. I used bash on Linux and I could provide some examples using bash, if that helps.

AES Crypt does not encrypt directories. It only encrypts files. If you wish to encrypt an entire directory and all of its sub-directories, I would suggest you use a tool like "tar" to archive the files. Something like this:

Code: Select all

$ tar -czf /path/to/archive.tgz input_folder_name
$ aescrypt -e /path/to/archive.tgz
$ rm /path/to/archive.tgz
This will create a compressed archive of the folder, you then encrypt it, and remove it. You can do this all in one step:

Code: Select all

$ tar -czf - input_folder | aescrypt -e -p apple -o /path/to/archive.tgz.aes -
Note the - characters. This tells the shell to take input as standard input. Basically, it allows data to be piped right out of one program and into another. I use this technique to backup and encrypt folders on my own machines. (The one thing I do not like is putting the password on the command-line, so at some point we will introduce a -k option to allow reading the encryption key from a file.)

If you have a folder and you want to encrypt each file in it as a separate .aes file, you can do that. However, I've found that to be a bit messy to deal with. It's really much cleaner to create one large archive file. But, if you really want to do that, we could create a shell script that does that. This is the "UNIX way" of doing things. AES Crypt just becomes one tool in the chain :)
shet
Posts: 3
Joined: Sun Oct 07, 2012 10:08 am

Re: Specify path for output file?

Post by shet »

This is what I came-up with on my own. Not as fancy as yours but it seems to be working.
I used mv to move the output .aes files to the folder where I would like them to be. I would have preferred to have had them placed there via -o as part of the encryption command but I just couldn't seem to figure out how to make that work. The only other major test left is to make sure that these files can be decrypted on a Windows system (using the Windows command line version of aescrypt) and still be readable by their native app (which is a cross platform record keeper type app).

Code: Select all

# encrypt the contents of the folder. The wildcard seem to work for us.

aescrypt -e -p apple123 path/to/folder/*

# move the encrypted output from above to the folder where we would like to have them.

mv /path/to/folder/*.aes /path/to/different/folder/
p.s. bash seems to be the default shell on all recent MacOS X versions.
Post Reply