Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
31 user(s) are online (15 user(s) are browsing Forums)

Members: 1
Guests: 30

Mr_byte, more...

Support us!

Headlines

 
  Register To Post  

(1) 2 »
LHA Archiving questions....
Just popping in
Just popping in


See User information
Hello!

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.

Thanks in advance. :)

Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
@Cageman

I have set up a button in DOpus4 which does that.

It uses an ARexx script I made, PackDirs.rexx, which looks like this:

/* PackDirs.rexx */

parse arg Subdir

Subdir 
strip(Subdir'b''"')

Pathend max(lastpos("/"Subdir), lastpos(":"Subdir))
if 
Pathend 1 then exit

Basename substr(SubdirPathend 1)
if 
length(Basename) < 1 then exit

MyCmd 'lha -x -r -a -m -e -F a "' || Basename || '.lha" "' || Subdir || '"'
address command MyCmd


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 .

Best regards,

Niels

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
Very cool @nbache

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. :)

Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
@Cageman

Quote:
Where would I need to store your REXX script?
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.

Best regards,

Niels

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
I've copied your script, pasted into notepad and saved it as PackDirs.rexx in REXX:

I have then followed your instructions in setting the button up in Dopus4 with

rx REXX:PackDirs.rexx {f} (as an AmigaDOS command)

However I get an error message that reads like this:

lha -x -r -a -m -e -F a "S.lha" "SYS:S": Unknown command

When testing using the S directory in my Workbench installation.

Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
Tested with a directory I unpacked to RAM: and then wanted to pack it to RAM:

The directory is called WhatIFF1.04

Please insert Volume lha -x -r -a -m -e -F a "WhatIFF1.04.lha" "RAM:" in any drive.

:D

Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
@Cageman

You probably don't have the LhA command installed, or it is not in your search path.

Try opening a Shell and enter:

which lha

If it lists a path to an LhA command, what is it?

If not, are you sure you have it at all?

Otherwise go to OS4Depot:

http://os4depot.net/?function=showfil ... e=utility/archive/lha.lha

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.

Best regards,

Niels

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
Here is what I get when I test if I have LHA installed or not.

New Shell process 4
4.Workbench:> which lha
Workbench:C/LhA

And this is the version of the lha command in Sys:C

4.Workbench:> version lha
LhA 2.15 AOS4 Jan 3 2011

So... it seems I have LhA command installed in the correct place (Sys:C).

Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
I also tried this with my emulated Amiga (WinUAE) running AmigaOS 3.9 and I get the same error message.

I'm very puzzled at this moment. :D

Current Amiga computers: Vampire V4-SA, Sam460ex, A1-X5000/020
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@Cageman

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.


Edited by jPV on 2022/4/11 17:30:01
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
An update!!! :)

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
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@jPV

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. :)

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@CagemanQuote:
Cageman wrote:@jPV

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.

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@jPV

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. :)

Go to top
Re: LHA Archiving questions....
Amigans Defender
Amigans Defender


See User information
@Cageman

How about;
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.

Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
All good solutions, of course.

I just enjoy the integration into DOpus4 and being able to hit a button and be done with it .

At the moment I can't figure out why that one gave an error for you.

Anyway, Chris' two-liner above is also good and simple; I have to brag and show how to make it a one-liner, though:

List DIRS LFORMAT "lha a -a -e -r %N.lha Work:Games/%N/#?" Work:Games/ | execute IN:



(I haven't attempted to improve the ability to cope with spaces, but it should be possible by inserting some *" at appropriate places.)

Best regards,

Niels

Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@all

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
Go to top
Re: LHA Archiving questions....
Just popping in
Just popping in


See User information
@nbache

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?

Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
@Cageman

Quote:
Discord ... PC
Sorry, N/A

Best regards,

Niels

Go to top
Re: LHA Archiving questions....
Just can't stay away
Just can't stay away


See User information
@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

Go to top

  Register To Post
(1) 2 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project