Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-18-2010, 10:53 AM   #1
Registered: Dec 2003
Posts: 78

Rep: Reputation: 1
scp is looping without being in a loop


I'm trying to execute some fairly simple code to transfer some files from one server to another.

$ cat

cd /cygdrive/g/directory/usr
rm -Rf /cygdrive/g/directory/usr/*
cd /cygdrive/g/directory/var
rm -Rf /cygdrive/g/directory/var/*
# scp -r -C -c blowfish root@ .
cd /cygdrive/g/directory/usr
scp -r -C -c blowfish root@ .

As you can see there are no obvious loops. Yet the transfer never gets to the second scp statement. It hits a particular subdirectory of /usr and continues to transfer that subdirectory and its' contents until I break out of the seemingly looped condition.

Neither of the primary directories nor the subdirectories are symbolic links. I'm at a loss for why this simple script keeps looping without any looping statements in the script.

I'm sure it's something simple I'm just not able to see. Any help/comments would be gratefully appreciated.


Old 06-18-2010, 12:18 PM   #2
Registered: Dec 2003
Posts: 78

Original Poster
Rep: Reputation: 1
I think I've found the source of the problem. Apparently there ARE symlinks along the lower subdirectory path's. I understand that scp will follow symlinks blindly and in this case into a loop.

So my question is how do I recursively tranfer large directories of files without traversing symlinks? I've seen two altrernative means, one is to tar the files and then untar them at the other end. The other has to do with rsync, which I'm not familiar with.

I have yet to find a solution that uses scp that skips symlinks. Any ideas? Thoughts?

Again, thanks for looking and your time & comments are appreciated.



loop, scp

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 03:49 PM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
bash loop within a loop for mysql ops br8kwall Programming 10 04-30-2008 03:50 AM
for loop only works properly on first loop symo0009 Programming 1 12-25-2005 05:17 PM
while loop not looping as intended Tarts Programming 7 11-28-2003 02:50 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration