View Full Version : How to pass filenames with spaces to CRMData?
BarryB
28 December 2011, 20:19
I'm trying to crunch a datafile with spaces in the name using crmdata in a CLI window but have stumbled into a problem that either crmdata or AmigaDOS can't handle. I know I can rename the file then rename it back but I have a few files to crunch and would rather it work with spaces intact in the filename. I also have a menu command in DiskMaster setup so I can tag numerous files and crmdata will crunch the lot, provided there are no spaces in any device name or filename, which is why I want to find out how to crunch files with spaces in the name.
An example: If I issue the command: crmdata -2c "filename with spaces" then crmdata spits out the response: Could not open '"filename'! so it appears to ignore the double quotes around the file and tries to process the filename 'as is' meaning it takes the first double quote " as part of the filename then when it hits the space it throws up an error.
Thumbed through my Workbench 3.0 User's Guide but it doesn't offer any help other than enclose the entire path in double quotes, which I've tried with the same result. Anyone have an idea what's wrong?
Galahad/FLT
28 December 2011, 20:30
Have you tried using some AmigaDOS wildcards instead?
BarryB
28 December 2011, 21:12
Tried all sorts of ways but can't work it out. Tried renaming a file with spaces using the conventional rename command and that works no problem as long as the destination filename is in quotes too e.g.:
rename "file with spaces" "filewithspaces" and rename "filewithspaces" "file with spaces" both work as you would expect so I'm thinking crmdata isn't handling spaces in the filenames!
prowler
28 December 2011, 21:19
Tried all sorts of ways but can't work it out. Tried renaming a file with spaces using the conventional rename command and that works no problem as long as the destination filename is in quotes too e.g.:
rename "file with spaces" "filewithspaces" and rename "filewithspaces" "file with spaces" both work as you would expect so I'm thinking crmdata isn't handling spaces in the filenames!
Have you tried using some AmigaDOS wildcards instead?
Hi Barry,
What Galahad means is, for example using crmdata -2c file?with?spaces as your command line instead. Have you tried that?
Leffmann
28 December 2011, 21:35
AmigaDOS and the common shells for Amiga don't recognize wildcards in command lines, that's part of the program's job, and while they do recognize quotes in the command line for redirecting in- and output, the part of the command line which gets sent to your program is always passed as-is, and it's entirely up to the program to parse it.
prowler
28 December 2011, 21:47
Thanks for that little gem, Leffmann. :) I use wildcards all the time with list, as well as lha and lxz archivers, and didn't realise it was up to the program, in the case of the archivers, to parse the wildcards. :rolleyes
BarryB
28 December 2011, 21:51
Looks like Leffmann is spot on.
No matter how I use wildcards in the command, crmdata just processes the input 'as-is' meaning it treats the space as the end of the filename and errors because there is no filename with the name it's parsed or, if using wildcards, expects the filename to have wildcards in it too.
Galahad/FLT
28 December 2011, 22:08
There must be an option in crmdata to accept wildcards.
Have you tried typing 'crmdata ?'
Doesn't that give a list of all accepted commands and parameters?
BarryB
28 December 2011, 22:22
Yep, that's the first thing I tried:
Usage: CrMData [-12cdfsy] <sourcefile> [<destfile>]
-1 : use CrM-Normal algorithm
-2 : use LZ-Huffman algorithm
-c : crunch only
-d : decrunch only
-f : enable Power-LED flashing
-l : save file, even if it becomes larger
-s : use Sample-Mode
-y : enable password encryption
Can you spot anything I've missed?
clenched
29 December 2011, 05:52
BarryB - If you don't mind a little patching, this trouble is easily overcome.
CrMData V1.01.
1 - Decide on a new delimiter to mark the end of the filename. This character should be an obscure one as far as filenames go. I chose ~($7E) as example. If it could be worked so that directories are excluded then / would be ideal.
2 - hex editor at offset $159 change $20 to $7E, save it back.
If you're not giving a second filename then nothing changes. The original is overwritten.
To use a second filename the syntax becomes what is pasted below straight out of CLI.
I'm totally unfamiliar with "DiskMaster" so its effects with this are unknown.
1.Ram Disk:> dir c#?
Ram Disk:Clipboards (dir)
CrMData
1.Ram Disk:> CrMData CrMData~C r M D a t a
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `CrMData' (2620 bytes)...
Crunching... 2620 -> 1890 (27% gain)
Saving `C r M D a t a' (1904 bytes)...
1.Ram Disk:> dir c#?
Ram Disk:Clipboards (dir)
C r M D a t a CrMData
1.Ram Disk:> CrMData C r M D a t a~CrM Data
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `C r M D a t a' (1904 bytes)...
Decrunching (1890 -> 2620)...
Saving `CrM Data' (2620 bytes)...
1.Ram Disk:> dir c#?
Ram Disk:Clipboards (dir)
C r M D a t a CrM Data
CrMData
1.Ram Disk:> CrMData CrM Data
CrMData V1.01 --- (c) 1993 Thomas Schwarz
Loading `CrM Data' (2620 bytes)...
Crunching... 2620 -> 1890 (27% gain)
Saving `CrM Data' (1904 bytes)...
1.Ram Disk:>
BarryB
30 December 2011, 00:07
:bowdown clenched :great
Once I figured out crmdata needed unpacking first I applied your patch and can happily pack files with spaces in the name, woohoo :spin
Diskmaster uses the %s variable to pass the path to an external program except it doesn't seem to work, but that's a Diskmaster issue, your patch works fine from the CLI.
vBulletin® v3.7.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.