Hello everyone.
I'd like to ask for your help for my files at work. I have multiple folders each containg information from projects. I just learned how to compress them into 7z in the command line. We use windows at work but my work laptop is very slow, so i bring the folders home and do the compression here. I use this:
7za a -t7z -m0=lzma -mx=9 -mhe=on -pMy_password ProjectFolder01.7z ProjectFolder01
All good there, but i have around 200 folders, and i tried to use a FOR but I only find examples for files and not folders. The whole idea is to compress each folder, with encryption, keep its original name, but not all of them at once, that's why I thought of a FOR loop, that way the pc creates a 7z file using all resources (and disk writing) without any problems.
Thanks for your help!
Multiple Folders into Multiple 7zip Files with Encryption
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
- SprinterDriver
- Level 4
- Posts: 260
- Joined: Sun Jan 25, 2015 3:35 pm
- Location: Norway
Re: Multiple Folders into Multiple 7zip Files with Encryption
7zip accept using a listfile as input. I recommend that before doing multiple calls to build up the 7z file.
So I got this bright idea. But when I tried to grab the light bulb, I did not hurt my hands as expected from a warm bulb, because it turned out to be one of those LED bulbs.
Re: Multiple Folders into Multiple 7zip Files with Encryption
Hey SprinterDriver... I think if you put two or more directories in the input section, all of them go to a single 7z file... that's not what I'm after. I do this in Windows using this:SprinterDriver wrote:7zip accept using a listfile as input. I recommend that before doing multiple calls to build up the 7z file.
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" "%%X\"
But of course, there's no encryption and the syntax is for the windows command prompt. I was looking for the same thing in bash.
Re: Multiple Folders into Multiple 7zip Files with Encryption
If you can do it in Windows command line, you can surely do it in Linux command line. Download the book found at the link below, and you should be able to crank out a command to do that pretty quickly. And if not, I bet one of the wizards here on the forums can give you a one liner to do that.
http://linuxcommand.org/tlcl.php
http://linuxcommand.org/tlcl.php
“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan
Re: Multiple Folders into Multiple 7zip Files with Encryption
Thanks for reference jimallyn. I've read the guide, and like I said, can't find a correct syntaxis to use for directories. I counts variables like counters and things... but folders??.jimallyn wrote:If you can do it in Windows command line, you can surely do it in Linux command line. Download the book found at the link below, and you should be able to crank out a command to do that pretty quickly. And if not, I bet one of the wizards here on the forums can give you a one liner to do that.
http://linuxcommand.org/tlcl.php
Re: Multiple Folders into Multiple 7zip Files with Encryption
Hi "Memoox",
I just read your post and the good replies to it. Here are my thoughts on this as well.
I would recommend installing "PeaZip" in both your MS Windows and Linux computers which can easily do this for you using a nice desktop application. Just right click in the top box to pick folders and files, or use the toolbar options..
http://www.peazip.org/
Linux Download - In Linux I install PeaZip using the GTK ".deb" file which works better for me than the QT version, but you can try either one.
http://www.peazip.org/peazip-linux.html
FYI: You can also use an Internet "cloud" service to sync your folders/files from work computers or home computers (using this provides a backup too). like excellent "pCloud" (10+gb free), "Mega.nz" (encrypted 50gb free), Google Drive (15 gb free), DropBox (2gb free), etc... Theoretically, if nobody knows your Cloud provider's login password, whether their service is encrypted or not, your files are secure. You can also install and use Cryptomator.
Encrypt Your Cloud Files With Cryptomator (Open Source, Cross-Platform)
http://www.webupd8.org/2016/04/encrypt- ... -with.html
Hope this helps ...
Click image to view larger size, or right click open in a new tab, then you can click again to enlarge or shrink it.
I just read your post and the good replies to it. Here are my thoughts on this as well.
I would recommend installing "PeaZip" in both your MS Windows and Linux computers which can easily do this for you using a nice desktop application. Just right click in the top box to pick folders and files, or use the toolbar options..
http://www.peazip.org/
Linux Download - In Linux I install PeaZip using the GTK ".deb" file which works better for me than the QT version, but you can try either one.
http://www.peazip.org/peazip-linux.html
FYI: You can also use an Internet "cloud" service to sync your folders/files from work computers or home computers (using this provides a backup too). like excellent "pCloud" (10+gb free), "Mega.nz" (encrypted 50gb free), Google Drive (15 gb free), DropBox (2gb free), etc... Theoretically, if nobody knows your Cloud provider's login password, whether their service is encrypted or not, your files are secure. You can also install and use Cryptomator.
Encrypt Your Cloud Files With Cryptomator (Open Source, Cross-Platform)
http://www.webupd8.org/2016/04/encrypt- ... -with.html
Hope this helps ...
Click image to view larger size, or right click open in a new tab, then you can click again to enlarge or shrink it.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
Re: Multiple Folders into Multiple 7zip Files with Encryption
I'm kinda bad and lazy with scripting but pretty good with 'vi', so I'd do a project like that in a very convoluted way:Memoox wrote:that's why I thought of a FOR loop,!
Code: Select all
ls ProjectFolder* > a # or some other way of getting the list of directories...
cp a b
vi a # stick ".7z " at the end of the dir name and "7za a -t7z -m0=lzma -mx=9 -mhe=on -p My_password " in front of it
paste a b > c # file 'c' has two columns made from files a and b.
sh c # would make all the compressed directories
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
Re: Multiple Folders into Multiple 7zip Files with Encryption
Thanks fot the replies.
About Peazip... when I was looking for a solution for this, I came across Peazip, which in my opinion is very good. But in this case the whole thing is to use it in the command line or a script.
This weekend I've found to way to do it. After a lot of trying it was simpler that I thought. If you think I should write in form of a tutorial, I will.
So first of all you have to be in the directory. then you use a FOR command like this:
To break it down a little bit:
For d in * creates the folder list in the directory and stores it "d"
do 7za -m0=lzma -mx=9 -mhe=on -pMy_Password $d.7z $d which the 7z command that creates the 7z file
And then just close the loop.
Hope it helps anyone that has this problem on their hands
About Peazip... when I was looking for a solution for this, I came across Peazip, which in my opinion is very good. But in this case the whole thing is to use it in the command line or a script.
This weekend I've found to way to do it. After a lot of trying it was simpler that I thought. If you think I should write in form of a tutorial, I will.
So first of all you have to be in the directory. then you use a FOR command like this:
Code: Select all
for d in *;do 7za -m0=lzma -mx=9 -mhe=on -pMy_Password $d.7z $d;done
For d in * creates the folder list in the directory and stores it "d"
do 7za -m0=lzma -mx=9 -mhe=on -pMy_Password $d.7z $d which the 7z command that creates the 7z file
And then just close the loop.
Hope it helps anyone that has this problem on their hands