[opensuse] rsync without going up the directory tree
I'm trying to copy rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want. I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints? -- Per Jessen, Zürich (12.9°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 08/25/2014 07:38 AM, Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints?
You should omit the ".*" and "*" from your command line: rsync -av server:/dir/jessen/ /home/somedir will copy the entire contents of /dir/jessen, including hidden files, to /home/somedir. Be sure to include the trailing / on the source directory argument--otherwise you will get the source directory, too, copying the entire directory tree /dir/jessen to /home/dir/jessen. I usually use the command line options "-vasP" to copy files with spaces in their names and also get a progress indicator. Jim -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, 25 Aug 2014 07:54:29 -0700 Jim Cunning wrote:
On 08/25/2014 07:38 AM, Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints?
You should omit the ".*" and "*" from your command line:
rsync -av server:/dir/jessen/ /home/somedir
will copy the entire contents of /dir/jessen, including hidden files, to /home/somedir. Be sure to include the trailing / on the source directory argument--otherwise you will get the source directory, too, copying the entire directory tree /dir/jessen to /home/dir/jessen.
I usually use the command line options "-vasP" to copy files with spaces in their names and also get a progress indicator.
'rsync -avAX sourcedir/ targetdir' makes a true mirror of the source directory under 'targetdir/' assuming there are no hard links. I use this all the time to make and restore snapshots of live installations and user space contents ... works great. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hello, On Mon, 25 Aug 2014, Carl Hartung wrote:
On Mon, 25 Aug 2014 07:54:29 -0700 Jim Cunning wrote: [..]
I usually use the command line options "-vasP" to copy files with spaces in their names and also get a progress indicator.
'rsync -avAX sourcedir/ targetdir' makes a true mirror of the source directory under 'targetdir/' assuming there are no hard links. [..]
I use rsync -auxlPRAXSHD --delete /SOURCE/ /DEST/ to clone '/' to a new dir prior to 'zypper dup'ping the copy. -dnh -- Never be afraid to try something new. Remember, amateurs built the ark; professionals built the Titanic. -- Anonymous -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 08/26/2014 06:24 AM, David Haller wrote:
rsync -auxlPRAXSHD --delete /SOURCE/ /DEST/
minor note: -a already includes -l: -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 08/25/2014 10:54 AM, Jim Cunning wrote:
On 08/25/2014 07:38 AM, Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints?
You should omit the ".*" and "*" from your command line:
rsync -av server:/dir/jessen/ /home/somedir
will copy the entire contents of /dir/jessen, including hidden files, to /home/somedir. Be sure to include the trailing / on the source directory argument--otherwise you will get the source directory, too, copying the entire directory tree /dir/jessen to /home/dir/jessen.
I usually use the command line options "-vasP" to copy files with spaces in their names and also get a progress indicator.
Thank you for that last, Jim! Now, what if I want to save BOTH ~anton/MyDocuments and ~anton/MyMusic to the USB stick at /mnt/disks/usb101/ Do I have to issue two commands? If I run rsync ..... ~anton/{MyMusic,MyDocuments} ... that gets expanded by the shell before handing to rsync. The example in the man page rsync -av host:file1 :file2 host:file{3,4} /dest/ raises some questions in my mind about direction and completness of specification. -- /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Anton Aylward wrote:
On 08/25/2014 10:54 AM, Jim Cunning wrote:
On 08/25/2014 07:38 AM, Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints?
You should omit the ".*" and "*" from your command line:
rsync -av server:/dir/jessen/ /home/somedir
will copy the entire contents of /dir/jessen, including hidden files, to /home/somedir. Be sure to include the trailing / on the source directory argument--otherwise you will get the source directory, too, copying the entire directory tree /dir/jessen to /home/dir/jessen.
I usually use the command line options "-vasP" to copy files with spaces in their names and also get a progress indicator.
Thank you for that last, Jim!
Now, what if I want to save BOTH ~anton/MyDocuments and ~anton/MyMusic to the USB stick at /mnt/disks/usb101/
Do I have to issue two commands?
rsync --options ~anton/MyDocuments ~anton/MyMusic /mnt/disks/usb101/ -- Per Jessen, Zürich (12.9°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Monday 25 of August 2014 16:38:52 Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
Perhaps .[^.]* works instead. My take for the command line would be rsync -av server:/dir/jessen/ /home/somedir Notice the slash at the end of the source; man rsync. -- Regards, Peter -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Per Jessen wrote:
I'm trying to copy
rsync -av server:"/dir/jessen/.* /dir/jessen/*" /home/somedir
The idea being everything under /dir/jessen/ should end up under /home/somedir. This works fine except rsync also picks up '..' and traverses up the directory tree, which I certainly don't want.
I've tried a few variations with --exclude and --exclude-from, but nothing has worked. Any hints?
Thanks for all the replies, the answer came to me whilst I was out shopping. rsync -av server:/dir/jessen/ /home/somedir The trailing / being important. -- Per Jessen, Zürich (12.9°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (7)
-
Anton Aylward
-
auxsvr@gmail.com
-
Bernhard Voelker
-
Carl Hartung
-
David Haller
-
Jim Cunning
-
Per Jessen