I wonder if there is a way to archive a list of directories so that each directory gets its own archive. Let me explain... Lets say I have a directory that looks like this
A B C
Ok... what I would want to do here is to not have to archive these 3 directories manualy, one by one. What I would want to do is to have them archived like this:
A.lha B.lha C.lha
Similar to how WinRAR allows for each selected file (or directory) to get its own archive.
Any ideas on how to achive something like that? And yes... it has to be LHA for reasons.
In the button definition, I have an AmigaDOS command line of:
rx REXX:PackDirs.rexx {f}
- and the following options checked:
CD destination Do all files Output window Rescan destination
and a Close delay of 2.
When using it, I mark the files/dirs I want in one lister and set the other lister to where I want the archives.
Note that if your source location is somewhere down in a subdirectory, the parent hierarchy path will be included. If I want to avoid that, I usually copy what I want to archive to RAM: (or the root of some other volume) and use the button from there.
Hope you can use this or at least let it inspire you.
BTW, the LhA switches may not all be relevant, I just have a habit of stating them all like a sort of "spell" I can remember .
I have to mention that I am a returning user of AmigaOS (I recently got my AmigaONE X5000)... and I do remember using Rexx scripts back in the late 1990:s... However, I will probably need more help and take baby steps with this...
First question... Where would I need to store your REXX script? :D
The rest regarding Dopus 4 looks easy enough to setup. But then again, I might have more questions. :)
The rx command expects to find its scripts in REXX:, which is an assign which normally points to the S:Arexx/ dir (this is set up in the standard OS 4 Startup-Sequence).
So simply put it in S:ARexx/ (which again is normally the same as SYS:S/ARexx/), and it will be found there by rx.
and download it. Now, how to extract an LhA archive without LhA, you might wonder? Start the UnArc program in your Utilities drawer, load the archive from where you downloaded it to, and extract the contents into RAM: (or wherever).
Then copy the LhA command into your C: directory, and see if that doesn't help.
The magic here is that UnArc uses xadmaster.library for extracting the LhA file, so it doesn't need the command line version of LhA, but my ARexx script does.
This can be done in the Shell quite easily, for example, like this:
List DIRS LFORMAT="LhA -a -e -x a *"%N.lha*" *"%N*"" > T:lha_script
Execute T:lha_script
This works if you CD into the corresponding dir first, and it creates archives in the same dir. But you could expand this to a better script which would take source and destination directories as arguments.
Some guys over at a Swedish Amiga forum helped me solve this in a different way.
Go to OS4Depot, download and install UHCTools. It includes the ForEachLine command...
Here is an example script. First it creates a list of all directories inside Work:Games/ and saves it to a file called "dirs" in T:
Then it, for each line in the file "dirs", creates an .lha archive with the same name as in the list in the file "dirs". The resulting archives are stored in T: so it is easy to move them wherever you want them.
;BEGIN Script List DIRS LFORMAT "%N" Work:Games/ >T:dirs ForEachLine T:dirs Lha a -a -e -r ${LINE}.lha Work:Games/${LINE}/#? EndForEach ;END Script
Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Ahh... yes... well... I got a similar but different solution... see my previous post... I must have made that post while you were making yours. :)
Heh, yeah, but you got an ugly solution ;) Why to use 3rd party tools when you can do it in OS, and I also think that the solution you got doesn't work when there are spaces in directory names.
I have to say that I am no expert in these things at all. That said, with 15+ years of Cinematics productions for games, spaces in names/directories are a big no-no. It is so rooted in me nowdays that I treat the Amiga the same way. :)
List DIRS LFORMAT "lha a -a -e -r %N.lha Work:Games/%N/#?" Work:Games/ >T:script
Execute T:script
Adapted from the script you posted, but without a 3rd party command!
You can also get rid of the path in that LFORMAT but I can't remember the formatting command off-hand. It also needs double-quotes around the paths, I think that's *" but didn't add it as I'm not sure.
I am very greatfull with all the suggestions that YOU ALL posted and took time to post. And again, I am NOT the typical Amiga User... the only reason I had a super expanded Amiga 1200 back in the days was because of the creativity tools others developed. All the mod trackers, Octamed Soundstudio, LightWave and Imagine etc.
This is also why I am an Amiga user today... the creativity and friendship.
This means that I do not really know how to write arexx scripts or scripts related to LHA that automate things. I am slowly learning. ;)
With that said and done... today, with the solution that the Swedish Amiga Users presented to me, I have succefully done what I initially asked for.
3374 archives have been made with very little effort compared to what it would have taken doing it manually.
Did the Swedish Amiga Users come to the best solution? From what I see here, no (since I had to resort to install some 3:rd party tools). But they were the first to come to a solution that, despite not being "perfect" worked out in an excellent way for the needs I had in this particular situation.
What works works, and I have yet to test the solutions that you have posted here, but I have copied them and saved them as textfiles.
Thank you ALL so much for assisting me in finding a solution. You guys rock. I will probably have more questions about AmigaONE X5000 in the future.
:)
<3 <3 <3
Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Yeah... if it works for you it "should" work for me... I am quite puzzled with that.
If you are on Discord with a PC we can probably setup a session where I share my Amiga screen (I have a capture card) and then walk and talk through it... Maybe I made a misstake somewhere that we just cant see at the moment?
@nbache wrote: "I just enjoy the integration into DOpus4 and being able to hit a button and be done with it "
I'm a DOpus4 user myself and thought I'd point out a simpler method of accomplishing archiving seperate directories.
In the button editor select AmigaDOS and enter this line: LHA -a -x -r -X a "{d}{ou}.lha" {o}
Select "CD Source" and "Do all files"
You use a lot more options in your script but I don't think that should affect the result of doing it the above way. However, if you want to archive a directory's icon along with the directory a script migh be easier.
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450