You can move one item(subtree) and change the entry name(top dir name) in the process.
if the target is a dir, you can have many sources: different user or host or path.
if the target is a dir, you can move whole subtrees with -r. For repeatability, it is best to move subtrees, without renaming, to either an absolute path or a target that will be the parent dir. Else, there can be target/source/ and target/source/source/ ! For instance, "scp /usr/local/bin xxxx:/usr/local" or "cd /usr/local ; scp bin xxxx:/usr/local". No matter how often you run it, you will not create xxxx:/usr/local/bin/bin/ like a repeat of "cd /usr/local ; scp bin xxxx:/usr/local/bin".
you can be on a different host altogether from sources and target!
has -p to preserve timestamps, ownership and permissions (but it can make problems if different user or group, source to target).
-C or similar adds compression, also nice for the network and for big move speed or multiple parallel copies, especially if the sending side is CPU rich. For real speed freaks with slow networks, I achieve the same effect as scp -C using more CPUs and my coice of compression with:
Then, I have a dumb demux tool xdemux.c or dumux.c to allow dividing the file list for N parallel runs (I like 2 x sending system CPU count, extras are OK as they deal with imbalance), but sometimes ssh gets sick from too much pressure on startup or too many sessions. On a secure network you can use rsh/remsh and save the encrypton costs:
Last edited by DGPickett; 06-24-2011 at 01:01 PM..
Looks like the space before scp target got lost, but that's the idea.
Why "ftp bla bla bla mget bla bla bla" when you can scp on one line?
Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.
Last edited by DGPickett; 06-24-2011 at 01:11 PM..
"ftp bla bla bla mget bla bla bla" this is the one you asking with the previous code?
space before scp target got lost - i did not get you..
it is a script to automize the file transfer & send mail process.
Using ksh on systems like Solaris with /dev/fd/[0-9]* or bash <(...) or >(...), or on systems like Solaris with /dev/fd/[0-9]* using /dev/stdin or /dev/stdout, you can even scp from or to a named pipe and pipe the data to/from your process in real time.
maybe should be (without hypertexting and underlining from web site:
Also, '...' are overkill as the host: stifles local globbing. I like to " around $var, though, in case they develop white space or emptiness:
Keep it simple, and you can make more complex things work!
I hate:
temp and intermediate files,
file name collisions,
complicated file names,
running out of disk space,
extra latency,
underutilized CPUs
and so I love all sorts of pipes.
Last edited by DGPickett; 06-24-2011 at 01:30 PM..
yes the single ' can be overkill but shouldn't hurt. The " around $DIR should be fine(might be better if a path contains blanks anyway).
also, in stead of a password, you suggested me to use a private/public key pair (SSH - keygen). i am stucked here. i read the man page and understand but i am blank face(?) because not able to understanding how to use these expressions in my script? if possible, plz suggest me how could i do it? Thanks
You can find articles all over, including here, on getting ssh started. Get ssh2 if you can. Some sort of ssh keygen will give you nice big tough keys. Do not put a password in the keys, or you are back in the same kettle with better security. Make sure the permissions are right on the .ssh/.ssh2 dir, wherever it is. Here, it is not in $HOME because it is a mounted NFS disk. Get the local host name to work for "ssh host_name pwd". Once you get that ssh to work paswordless, if you copy the .ssh/.ssh2 dir to a remote host using scp -rp with a password once interactively, you will be passwordless to that host, give or take an initial save of host keys.
Linux System having all Perl, Python, PHP (and Ruby) installed
From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file
eg
eg
a Shell script run in a case statement call to run a php file, also Perl or/and Python file???
Like
#!/usr/bin/bash
....
....
case $INPUT_STRING... (1 Reply)
I'm wondering how programmers develop new Web Development languages because I want to learn how everything begins from the start. Let's say I'm planning to write a new language for the Web. How do I do this? Is there anyone who knows about the way Web Development languages first appear ? I'm... (3 Replies)
I need a small and simple clarification...
Can someone tell me whether PERL is a programming language or not.
Also, can shell scripts also considered as programming language or not.
Also, please tell me the exact difference between programming language and scripting.
Please help.... (3 Replies)
Hello,
I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Can someone enligten me on what below program does?
I understand getchar and putchar.. but what is this program suppose to do?
I try to put printf on it, but it shows nothing..
can someone explain to me what this program is suppose to do?
It is reading something and assigning to c?
so, if... (8 Replies)
I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)