[Jprogramming] Finding & expanding files
Björn Helgason
gosinn at gmail.com
Sat Nov 5 02:21:27 HKT 2011
Before you try doing the expansion from J do it in a bat file
Once you manage to get the workings going in a bat file you can dynamically
create the bat file from J and execute it.
It is much easier than you may think to greate a bat file from J and then
you have all the power of J to change the ingredients of the bat file and
do what you wnat.
Test it out by manually create a bat file that works and does what you want.
Then from J create a bat file with the same contents and then you can
execute the bat file.
You can actually have one permanent bat file you call from J and have that
bat file do the copyings run the dynamically created bat file and cleanings
afterewards as needed.
Combine J and bat files freely.
You claim to be new to J and that is why I recommend that you do this in
steps and use the techniques you are familiar with first.
2011/11/4 Skip Cave <skip at caveconsulting.com>
> Before I get too involved with traversing the directory tree, I just need
> to be able to create a function that unzips a .gz file from J.
>
> Here's my scenario:
>
> I have a directory right off C: called "Gzip: where I installed the
> open-source gzip program. The gzip option I need is "-d" for "decompress"
>
> I put one of my "log.gz" files in that same gzip directory.
>
> Here is a command line expression I used, which works to expand my test
> log.gz file:
>
> In the command window, first I set the directory to the Gzip directory:
>
> C:> cd gzip
> C: Gzip>
>
> Then I enter the command:
> C: Gzip> gzip -d -v (-v is for verbose)
> log.gz 92.3% -- replaced with log
>
> C:Gzip>
>
> This worked, and the original log.gz file was replaced with the
> uncompressed log file. I would prefer to NOT have a replacement happen.
> Creating a new file with no extension, or a different extension would be
> better. Unfortunately, the gzip utility appears to not have a 'don't
> replace' option. But at least I got the file unzipped.
>
> However, when I tried this in J 6.02:
> spawn_jtask_ 'gzip -d ',;'c:gzip/log.gz'
>
> nothing happened. No error messages, nothing. And no unzipped file
>
> I also tried:
> fork 'c:\Gzip\gzip -d log.gz'
>
> Still nothing.
>
> What am I doing wrong?
>
> Skip
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: gosinn at gmail.com
gsm: +3546985532
twitter: @flugfiskur
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
More information about the Programming
mailing list