Visit Our UNIX and Linux User Community


SCP error: No such file or directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers SCP error: No such file or directory
# 1  
Old 02-23-2012
[Solved] SCP error: No such file or directory

Hi,


I am trying to do scp using the following script:
Code:
#!/usr/local/bin/bash

BUILDDATE=20120220

for line in `cat arch_host_plat_src_dest`
do
        src=`echo $line | cut -d: -f4`
        dest=`echo $line | cut -d: -f5`

    echo scp -p /builds/${BUILDDATE}/Integration/$src  root@10.216.123.456:/builds/gc/$dest
        scp -p /builds/${BUILDDATE}/Integration/$src  root@10.216.123.456:/builds/gc/$dest
done

I have a config file. The content of the file is given below:
Code:
-sh-2.05b$ cat arch_host_plat_src_dest
HP-UX-B.11.23-pa-risc-32:EBHP1100:HPUX-HPPA:hpux-hppa/{data.cab,agent.xml}:hp/hpux/parisc

Output
scp -p /builds/20120220/Integration/hpux-hppa/{data.cab,agent.xml} esm2@10.216.123.456:/builds/gc/hp/hpux/parisc
/builds/20120220/Integration/hpux-hppa/{data.cab,agent.xml}: No such file or directory


However, the given files very much exist in the mentioned source location. Also, if the run the same command on the command line, it works without any issue.

-sh-2.05b$ scp -p /builds/20120220/Integration/hpux-hppa/{data.cab,agent.xml} esm2@10.216.123.456:/builds/gc/hp/hpux/parisc
data.cab 100% 51MB 5.2MB/s 00:09
agent.xml 100% 242 305.7KB/s 00:00


I think, this portion in the config file must be the problem area: {data.cab,agent.xml}

I tried escaping, quoting in different ways that i could think of but couldn't get it working Smilie Smilie

Any help?


Thanks,
Gaurav


---------- Post updated at 07:05 PM ---------- Previous update was at 12:59 PM ----------

I got the solution. It was behaving that way because the variable (src) was just reading the string from the config file. It wasn't expanding the content present within curly braces.

This did the trick:

Code:
sh -c "scp -p /builds/${BUILDDATE}/Integration/$src  root@10.216.123.456:/builds/gc/$dest"


Last edited by vbe; 02-23-2012 at 10:02 AM..
# 2  
Old 02-23-2012
Glad you found out by yourself...

cheers
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #888
Difficulty: Easy
sed was developed from 1973 to 1974 by Bill Gates of Microsoft.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

No such file or directory error

I am new to shell scripting so I assume there is something basic I am missing but I have not been able to figure it out. When I run the following code from a script it can't find the paths to the directory or files. I can literally cut and paste the commands into terminal and they work fine. Why... (2 Replies)
Discussion started by: TryAgain12
2 Replies

2. Shell Programming and Scripting

scp from variable date directory

I am trying the mentioned script as #!/usr/bin/expect -f # connect via scp spawn scp root@10.71.15.34:/apps/log/ui/(date +\%Y\%m\%d)/BATCH*.log /root/BATCH_VSAT_MME01.log ####################### expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send... (2 Replies)
Discussion started by: Yogesh Pawar
2 Replies

3. Shell Programming and Scripting

No Such File or Directory error

Hi! I just recently started messing around with Unix, but I've come upon one problem multiple times. Whenever I try to run a shell script, for example; #! /bin/bash #-------------------------------------- # example1 #-------------------------------------- echo "Hello, World!" I... (5 Replies)
Discussion started by: SoapilyProne
5 Replies

4. Solaris

/bin/find: stat() error <File> : No such file or directory

Hi, I am getting below error in Solaris 10 SPARC when trying to issue a search on /var/tmp partition Below is the query /bin/find /var/tmp/ -type f -atime +1 Below is the result /bin/find: stat() error <File> : No such file or directory (28 Replies)
Discussion started by: prash358
28 Replies

5. Shell Programming and Scripting

No such file or directory error

Hi, After executing load_data.sh script , it completes the steps in script but give following error.Please let me know how to fix it. ./load_data.sh: ' missing ./load_data.sh: 0: not found for i in 1 2 3 do ###some processing#### DLOG=$( eval echo \${TXPCY_${i}_DATA_FILE_LOG} )... (4 Replies)
Discussion started by: sandy162
4 Replies

6. UNIX for Dummies Questions & Answers

directory copy with scp

I need to copy all files and directories with scp, but seems I am missing something? /usr/bin/scp -p /custscripts/* rmprod2:/custscripts doesn't copy directories and files under them. Please advise. (1 Reply)
Discussion started by: Daniel Gate
1 Replies

7. Solaris

how scp a file to server with space in the directory name

Hello forum, I’m trying to get someone else’s log rotation & sync script working. The ksh script is sending daily compressed log files to a Windows RSA envision server. The name of the directory is “CA SITEMINDER_<IP address of the sending server>”. The servers we are sending from are a mix of... (3 Replies)
Discussion started by: TKD
3 Replies

8. UNIX for Dummies Questions & Answers

Unable to copy file using SCP (Input/output & Permission denied error)

Hi, I am facing issue while using scp. Source & target machines are Linux & HP-UX respectively. On target machine, if I fire the following command, I get error: Now if I try scp on another file, which is on the same source machine, it works fine. All directories and subdirectories... (2 Replies)
Discussion started by: Technext
2 Replies

9. UNIX for Dummies Questions & Answers

Scp from local to external directory

Hi, I am trying to copy a whole directory from my home /RUN1 to the external directory jorgensen@hal.oerc.ox.ac.uk:/home/compchem/jorgensen/simulations The command I have used is: scp -r jorgensen@hal.oerc.ox.ac.uk:/home/compchem/jorgensen/simulations The error message I get is: ... (5 Replies)
Discussion started by: chrisjorg
5 Replies

10. Solaris

scp prompt when home directory is 777

Morning all, I was running some deployment scripts on Friday night that kept failing because it prompted for a password for a user I was already sudo'd in as when trying to scp a file onto itself. e.g. on server 51.123.123.123 as sudo dlam typing: scp testfile dlam@51.123.123.123:/tmp ... (5 Replies)
Discussion started by: dlam
5 Replies

Featured Tech Videos