[100281] in RedHat Linux List
Re: how do file permissions work? I can't copy in my Java EXEC() call
daemon@ATHENA.MIT.EDU (Michael Kleber)
Thu Nov 19 14:04:13 1998
From: Michael Kleber <kleber@math.mit.edu>
Date: Thu, 19 Nov 1998 14:02:54 -0500 (EST)
To: jkuntz@prominic.com, redhat-list@redhat.com
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
Justin Kuntz asks: (look, everyone, quote trimmed...)
> I have tried every variation of command-line arguments that I can think of
> to go along with 'cp'. All of these commands do EXACTLY what I would
> expect at a prompt when I type them in directly -- meaning, the files get
> copied and everything. All of my other commands seem to work fine from the
> Exec() call I am making.
>
> 11/19/98 05:32:03 AM EXEC rc=256 cmd=cp -fadp /home/ftp/bin/*
> /home/KKonnector/bin
I'm usually loath to send out answers that I don't know work --
witness the recent discussion on removing files starting with -, where
over half of the responses were incorrect -- and I can't test this.
But anyway...
I think your * just isn't getting globbed. Try copying a single file
using its full name, no * involved, and see if that works. If that
really is the problem we can work around it easily enough: tell cp to
copy recursively -- the two commands
mkdir /home/KKonnector/bin
cp /home/ftp/bin/* /home/KKonnector/bin
have the same effect as
cp -r /home/ftp/bin /home/KKonnector
Globbing, v: the process in which the shell expands wildcards typed in
the command line. The reason things like "rm *listing" won't remove
"-listing" is that the shell expands *listing into -listing, and by
the time "cp" sees the command line, there's no * on it, just a list
of words put there by the shell, and the first one starts with a -.
When you exec cp, java is running the cp program with your arguments
-- and the cp program doesn't know diddly about *s, that's the shell's
job. From that point of view, another solution would be to exec
csh -c "cp -fadp /home/ftp/bin/* /home/KKonnector/bin
Then java calls a shell, which globs and then calls cp, and all is
well.
(But you should really be having java call a shell script...)
--Michael Kleber
kleber@math.mit.edu
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.