English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 01 February 2018, 08:59   #1
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Need to extract batch of .lha archives into folders

On ClassicWB, how do I extract a whole folder of .lha archives (and sometimes .lzh archives) into a target folder, so that the contents of each archive are in a folder named after the archive? I would prefer to use the Shell, but I don't know the switches used.

I emulate ClassicWB with WinUAE and could extract the files easily on the Windows side, but I've found issues with character code pages when I do it that way.
Foebane is offline  
Old 01 February 2018, 09:38   #2
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
I remember it's not difficult at all but it's a long time I did not wrote a script on the Amiga (startup-sequence excluded ).
Have a look here for a first step.
malko is offline  
Old 01 February 2018, 09:45   #3
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Code:
list #?.lha lformat="lha x %n %m/" >ram:script
execute ram:script
thomas is offline  
Old 01 February 2018, 09:53   #4
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
I recently took a whole bunch of .lha archives and extracted them into folders with 7-Zip on the Windows side, then simply ran WinUAE and copied them over onto Amiga hard drives. There's no real harm in doing it that way, if the characters are plain ASCII 32-127, right?

I had trouble with a few of them that used specialised characters in the filenames in the contents that showed up one way in Windows and entirely differently on Amiga, and once transferred to Amiga, those files disappeared.

I'm really after a simple solution: extract on Windows and only extract (with DOpus) on Amiga IF this ASCII problem occurs.

It seems the only thing I have to do is to download the .lhas again and scrutinise the filenames in the contents, looking for unusual characters.
Foebane is offline  
Old 01 February 2018, 10:00   #5
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Quote:
Originally Posted by thomas View Post
Code:
list #?.lha lformat="lha x %n %m/" >ram:script
execute ram:script
I think I see how that works, Thomas. Does LHA work with .lzx's too? Can I simply replace #?.lha with #?.lzx ?
Foebane is offline  
Old 01 February 2018, 10:14   #6
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Quote:
Originally Posted by Foebane View Post
I'm really after a simple solution: extract on Windows and only extract (with DOpus) on Amiga IF this ASCII problem occurs.
You've also got another issue to contend with in that approach - you're losing all your Amiga file attributes as soon as you unpack them on a foreign filesystem. Most software will probably be fine without them, but some software might make use of the protection bits, comments etc., and will have problems if they're missing.

The Shell commands posted by thomas look like they're just what you need to extract all the archives on the Amiga side - that's the approach I would recommend.
Daedalus is offline  
Old 01 February 2018, 10:18   #7
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
They're only Demoscene prods, Daedalus, I doubt the attributes would make much difference.

Besides, a lot of the files I download are .exes and uncompressed anyway, and those attributes are already lost.
Foebane is offline  
Old 01 February 2018, 10:28   #8
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by Foebane View Post
I think I see how that works, Thomas. Does LHA work with .lzx's too? Can I simply replace #?.lha with #?.lzx ?
LHA does not work with LZX archives, it's the other way around : LZX can extract LHA.
If you want to extract both with a single command, you can do it this way :
Code:
list #?.(lha|lzx) lformat="lzx x %n %m/" >ram:script
execute ram:script
meynaf is offline  
Old 01 February 2018, 10:53   #9
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
As others have said; I always extract .LHZ / .LHA archives inside Amiga emulation and not via Windows...

Specialised characters, spaces etc. and also loosing protection bits, comments etc.
DamienD is offline  
Old 01 February 2018, 11:32   #10
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
I tried it this way:

Downloaded the archives in Windows (from Chrome) and then moved them from Downloads folder to a folder named "X" for temporary files. WinUAE configurations point to "X" as a hard drive on the Amiga side. On the Amiga, ran the script on X drive and then moved all extracted folders over to target drive (.vhd file).

I think this works best, as the archives are extracted on the Amiga side. I've already "reinstalled" the files on one of my drives this way. It was a bit more long-winded, but I think it's more "authentic", somehow. I just need practice on DOpus and Shell. It's been way too long.

Last edited by Foebane; 06 March 2018 at 15:18.
Foebane is offline  
Old 01 February 2018, 11:44   #11
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by Foebane View Post
I tried it this way:
Downloaded the archives in Windows (from Chrome) and then moved them from Downloads folder to a folder named "X" for temporary files. WinUAE configurations point to "X" as a hard drive on the Amiga side. On the Amiga, ran the script on X drive and then moved all extracted folders over to target drive (.vhd file).
As I understand "X" is a Windows FS (FAT or NTFS).
I advise you NOT to extracting your files in a non Amiga FS. When you extract your files you should directly extract them on the .vhd (Amiga FS formatted) drive.
malko is offline  
Old 01 February 2018, 11:51   #12
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Don't worry malko; you'll get to know Foebane...

He'll ask a lot of questions, get good / solid advise from people and then still do things his own way
DamienD is offline  
Old 01 February 2018, 12:09   #13
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Quote:
Originally Posted by malko View Post
As I understand "X" is a Windows FS (FAT or NTFS).
I advise you NOT to extracting your files in a non Amiga FS. When you extract your files you should directly extract them on the .vhd (Amiga FS formatted) drive.
Damn, I was afraid of that.

OK, so if I'm in the X drive with the archives, and I would like to extract them straight to, say, "Demos" in the .vhd, then do I modify Thomas' script to say the following?

Code:
list #?.lha lformat="lha x %n demos:%m/" >ram:script
execute ram:script
I think that's it, but what about a device name with spaces in it, like "Demos A-F"? Will this work?

Code:
list #?.lha lformat="lha x %n demos a-f:%m/" >ram:script
execute ram:script
Quote:
He'll ask a lot of questions, get good / solid advise from people and then still do things his own way
Contrary to what I normally do, DamienD, I'd like to follow through this time and do things properly on the Amiga platform. Heck, if I could, I would download the files totally on the Amiga side, but I have no idea if my html file with links, or the websites I use, will work there.
Foebane is offline  
Old 01 February 2018, 12:52   #14
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Quote:
Originally Posted by malko View Post
As I understand "X" is a Windows FS (FAT or NTFS).
I advise you NOT to extracting your files in a non Amiga FS. When you extract your files you should directly extract them on the .vhd (Amiga FS formatted) drive.
Actually, UAE tends to take care of that. As long as you do all your file operations inside the emulated Amiga, the exact storage of the files doesn't matter since UAE adds Amiga-specific attributes to special files or special fields in the Windows filesystem.
idrougge is offline  
Old 01 February 2018, 14:47   #15
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by DamienD View Post
Don't worry malko; you'll get to know Foebane...
He'll ask a lot of questions, get good / solid advise from people and then still do things his own way


Quote:
Originally Posted by Foebane View Post
[...] but what about a device name with spaces in it, like "Demos A-F"? Will this work?
Code:
list #?.lha lformat="lha x %n demos a-f:%m/" >ram:script
execute ram:script
As you have guessed, you have to change the command and then will have to escape the quotation marks surrounding the device/folder name. Maybe this link can be of any help.


Quote:
Originally Posted by idrougge View Post
Actually, UAE tends to take care of that. As long as you do all your file operations inside the emulated Amiga, the exact storage of the files doesn't matter since UAE adds Amiga-specific attributes to special files or special fields in the Windows filesystem.
Yes, correct. Nevertheless, I would personally avoid it if there is another choice .
@Foebane if not already red, you have a good explanation here (Using Directory Hard Drive part).
malko is offline  
Old 01 February 2018, 19:41   #16
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
I have spent an hour on this problem, and I think I've come up with a good way to automate the extraction from archives in X to the .vhd, and to copy folders containing exe files directly to the .vhd too. I just specify the final names I would like them to have on the Windows side, then run this:

Code:
x:
list #?.lha lformat="lha x *"%n*" *"demos:%m/*"" >xarc
list dirs lformat="copy *"%n*" to *"demos:%n*" all" >xfol
execute xarc
execute xfol
I settled for .lha as they're practically the only archives I've found for Amiga, the .lzx's are rarer. I can always add a second line for lzx's when they come up.

EDIT: Changed the script as only folder contents were being copied, rather than the folders themselves.

Last edited by Foebane; 01 February 2018 at 21:26.
Foebane is offline  
Old 01 February 2018, 22:15   #17
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by Foebane View Post
I have spent an hour on this problem, and I think I've come up with a good way to automate the extraction from archives in X to the .vhd [...].

If you want you may add a "-a" in your lha command. I let you check the help file included with lha for the meaning of this option
malko is offline  
Old 01 February 2018, 22:28   #18
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
...or display the syntax via Shell / CLI and then:

<program> ?
DamienD is offline  
Old 02 February 2018, 01:23   #19
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Eh?

EDIT: Never mind this response, I was out of it last night and not thinking straight.

Last edited by Foebane; 02 February 2018 at 12:00.
Foebane is offline  
Old 02 February 2018, 09:19   #20
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
DamienD is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to extract NDK39.lha Hiddenevil support.Apps 8 06 November 2017 11:14
Using Xdftool with LHA archives.. bugsymalone666 support.Other 6 25 June 2017 02:27
Self Extracting LHA Archives hipoonios support.Apps 7 16 January 2015 23:15
Dopus suddenly won't extract LhA Files manic23 support.Apps 3 30 March 2013 13:43
Any app to extract multiple archives??? keropi support.Apps 4 02 April 2007 13:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:38.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.48955 seconds with 14 queries