Hi I'm new to Macs and OSX, I'm using p7zip
cli app to compress folders with big files inside (1; 2 GB or more). So I managed to make a Bash script to do it in batch process when I go to bed and I'm not using the computer.
This the code:
#!/bin/bash
for folder in */
do
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=1024m -ms=on -mmt2 "${folder%/}.7z" "$folder"
done
I have this in Comp7zip.sh
file, I put that file inside the main folder that contains all the other subfolders I want to compress. So from the terminal I do:
$cd myfolder
$./Comp7zip.sh
Then in the terminal I can see how the 7z app is working, and it compresses all the folders just fine.
But since it is a bit annoying, copying the .sh file inside the folder and using the terminal every time, I use Automator to create a service and do it with a couple of clicks, this is the code:
#!/bin/bash
cd "$@"
for folder in */
do /usr/local/bin/7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=1024m -ms=on -mmt2 "${folder%/}.7z" "$folder"
done
It's almost the same, just add the cd "$@"
to use the selected folder in finder, so I have a new service that does the same thing that the .sh
file does.
I just select the folder that has all the subfolders I want to compress, then pick my service from Finder's context menu, works fine and compresses all the folders inside the selected folder.
The problem here is, that in this way I can't see the 7z app wile it's working, all the compressing is made in the background with just and icon of a little gear in the menu bar that indicate the compress is running, and nothing more.
So with little files this is not a problem the compress ends fast, but with large files, I can't see how the compress work is doing it.
So the question is, how can I make Automator to show me the running task in the same way the method with the .sh Bash file does?
Also any ideas of how to add to this process a way to compress files outside subfolders in the selected folder? I mean all this code only works with folders and it's content, but not with files, so how cam I make it work with folders and files in the same process?
I'm sorry for my grammar, English is not my native language.