Re: Need to find a file, if it exists move it to a new name in the same directory.
From: Tonij (tonij67_at_hotmail.com)
Date: 04/20/04
- Next message: GALVANO: "C Shell"
- Previous message: Stephane CHAZELAS: "Re: Remove last character"
- In reply to: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Next in thread: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Reply: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Apr 2004 14:41:21 -0700
"Chris F.A. Johnson" <c.fa.johnson@rogers.com> wrote in message news:<c63pj3$78o55$1@ID-210011.news.uni-berlin.de>...
> On Tue, 20 Apr 2004 at 14:16 GMT, Tonij wrote:
> > Hi all,
> >
> > I am working on a script to interogate several Solaris systems for a
> > file, if it is found I need to move it to a new name in the same
> > directory. i.e.
> >
> > /usr/local/filename > /usr/local/new.filename
> >
> > I have been messing around with a script and have it to the point
> > where I can find the file and echo the output, but I am at a loss as
> > to how to move it to the same directory. It is no problem to move it
> > to a static directory but the file may exists in different locations
> > on each box so I want to keep it where ever it is found as a new name.
>
> mv "$filename" "${filename%/*}/new.${filename##*/}"
Thanks,
The reason Awk got involved is because this file exists in different
locations on each system (if it exists at all), and I do not know the
exact location yet (that is part of what this script will do).
What I am having a hard time with is finding the way to give $filename
a value.
So to sum it up:
I have to log into 15 systems, find a file that may be in who knows
what location (if it exists at all), move that file to a new name in
the same directory it was found in.
Sorry, I should have made that a little more clear at first...keep the
ideas coming!
- Next message: GALVANO: "C Shell"
- Previous message: Stephane CHAZELAS: "Re: Remove last character"
- In reply to: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Next in thread: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Reply: Chris F.A. Johnson: "Re: Need to find a file, if it exists move it to a new name in the same directory."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|