- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: script to loop through directories and encrypt...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2006 05:02 PM
тАО10-13-2006 05:02 PM
script to loop through directories and encrypt all files using openssl into another directory
- Tags:
- OpenSSL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2006 05:54 PM
тАО10-13-2006 05:54 PM
Re: script to loop through directories and encrypt all files using openssl into another directory
example, the following command will run
through "directory" and every file under it,
and echo each file name. ("{}" represents
the name of the current file as it is
processed.):
find directory -exec echo {} \;
You can substitute the command you wish to
use for "echo {}". "find" offers many file
selection options, too, such as "-type f",
which would eliminate the directories
themselves:
find gzip -type f -exec echo {} \;
Strictly speaking, that selects only the
regular files, which excludes directories and
some other things, too. A more precise way
to eliminate the directories would be to
exclude the directories, rather than to
accept only the regular files:
find gzip '!' -type d -exec echo {} \;
If you could better describe your actual
requirements, there's almost certainly a
better method than your apparent plan.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2006 06:12 PM
тАО10-13-2006 06:12 PM
Re: script to loop through directories and encrypt all files using openssl into another directory
# cd
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 01:42 AM
тАО10-14-2006 01:42 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
openssl enc -aes-256-cbc -pass pass:mypass -e -salt -in myinfile -out myout.ssl
I have one dir with about 6 sub dir's and under that may be more sub dirs... I need a quick way to encrypt all data in the dir tree and move them into another location while hopefully maintaining the dir structure so those files could easily and quicky recovered to the original locations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 01:58 AM
тАО10-14-2006 01:58 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
You'd probably need to make the destination directories first, but that could be
scripted, too. Crudely:
find directory -type d -exec mkdir another_location/{} \;
Oops. Earlier references to "gzip" were
caused by thoughtless copy-paste from an
example I was running. Please read them as
"directory".
I assume that "another location" is easily
accessible in the file system, not requiring
FTP or something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 02:32 AM
тАО10-14-2006 02:32 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
One way would be to 'tar' (using *relative* paths) your source directory; encrypt the tarball; and un-tar it in your destination directory.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 02:37 AM
тАО10-14-2006 02:37 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 06:51 AM
тАО10-14-2006 06:51 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
use Sandmans/Stevens approach - slightly modified - to create the destination directory structure:
cd source
find . -type d | cpio -pd destination
In the second step take care for the files (untested!):
find . -type f -exec openssl enc -aes-256-cbc -pass pass:mypass -e -salt -in {} -out destination/{}.ssl \;
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2006 10:39 AM
тАО10-14-2006 10:39 AM
Re: script to loop through directories and encrypt all files using openssl into another directory
# cd