- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: rcp with variable filename
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 08:07 PM
05-31-2006 08:07 PM
rcp with variable filename
I'm writing a script to remotely copy a file from a non-unix server. As the filename is not fixed, I'm trying to use a variable to do that.
Here's the command that I'm using :
rcp remote_host:'\folder\$filename' $filename
Executing this resulted in error "The system cannot find the file specified."
How can I correct this?
Thanks in advance.
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 08:18 PM
05-31-2006 08:18 PM
Re: rcp with variable filename
try to remove the "'" symbol.
The rcp work fine with the name of the file?
Enrico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 09:04 PM
05-31-2006 09:04 PM
Re: rcp with variable filename
Thanks for the reply.
If the quotation is removed, it will not work. I need to speciy the full path.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 09:12 PM
05-31-2006 09:12 PM
Re: rcp with variable filename
shouldn't
rcp remote_host:'\folder\$filename' .
work also?
So how do you want to set $filename?
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2006 09:17 PM
05-31-2006 09:17 PM
Re: rcp with variable filename
try to substitute the single quota ' with the double quota ". The single quota not interpreted the $filename:
FILE=test
echo "$FILE"
test
echo $FILE
test
echo '$file'
$file
Enrico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 12:16 AM
06-01-2006 12:16 AM
Re: rcp with variable filename
So escape the escape character like this:
rcp remote_host:\\folder\\$filename $filename
and now it should work as you expect. Copying files and executing remote commands between very different computers requires careful attention to special characters.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 12:48 AM
06-01-2006 12:48 AM
Re: rcp with variable filename
rcpinfo -p master/client
check for these daemons,
rpcbind, status, nfs, mountd, nlockmgr, llockmgr
Note: unless your on something older like 10.20.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 01:32 AM
06-01-2006 01:32 AM
Re: rcp with variable filename
cd /local/directory
rcp remote_host:/folder/${filename} .
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 12:02 PM
06-01-2006 12:02 PM
Re: rcp with variable filename
will give it a try...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 12:51 PM
06-01-2006 12:51 PM
Re: rcp with variable filename
The scenario is this :
I'm trying to copy a file (has no fixed filename, hence the variable) from a Windows 2003 server to a UX machine.
The UX machine initiates the pulling of this file.
After trying all the helpful suggestion, I realise that Windows 2003 server may not understand the $filename UX variable.
Has anyone out there done something similar?
Any help is much appreciated.
Thanks ! :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 12:55 PM
06-01-2006 12:55 PM
Re: rcp with variable filename
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rcp.mspx?mfr=true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 01:12 PM
06-01-2006 01:12 PM
Re: rcp with variable filename
echo rcp remote_host:'\folder\$filename' $filename
Now you will see what the real command looks like. The single quotes are very special in that they turn off special character processing inside the single quotes. Do this instead:
echo rcp remote_host:"\folder\$filename" $filename
As you will see, double quotes will expand $variable names to their contents.
So you see that the Windows server never sees the $filename unless you use the single quotes to turn off the special processing. And of course $filename is meaningless to Windows (or any other remote computer).
There is another Windows 'feature' concerning directories. You sometimes have to double the backslashes, something like this: \\folder\\$filename. To eliminate the Windows ' path problems, try getting a file from the base disk as in: C:$filename
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 01:20 PM
06-01-2006 01:20 PM
Re: rcp with variable filename
Thanks for the very detailed explanation.
I now have a better idea of how the single and double quotes work.
And your tip worked !!
Appreciate your help !
Cheers !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 01:21 PM
06-01-2006 01:21 PM
Re: rcp with variable filename
Great job, Bill !