Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get unknow remote filename to local drive ?

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I need to copy a file from a remote server into the local server retaining the file name, but I do not know the entire file name.

EG. The remote file is NAT123.NSP (but I do not know that)
I try this command but it does not work;
rsh remote cat NAT123* >> NAT123*
because it calls the local file NAT123* (I need the local filename to be NAT123.NSP)

How do I get this unknown file across with the correct file name ?
 
ARe you doing ftp?

because you could do
ftp (ipaddress
root
password

binary
mget /mydir/nat*
and it will prompt you for each name that is close to it and you answer y or n
to copy it.??????????
and then you can move it to whatever name you want.........from the temp directory
----------------------------------------------
Or if you were doing many files you could do a for loop
for i in *
do
cp $i /mydir/$i
done
to get all the files.

If you did a cat above in your question, I don't think it would work...since the destination cannot be an *...and it would append all files that meet the criteria to one file........theoritically so cat nat* >> nat.nsp would work...but then all files that
meet the nat* WILL Be appended to the nat.nsp.......

Not sure what you really are trying to do.....nfs, a for loop etc. are probably
better than a cat?
Let us know and maybe we can help you more?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top