[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

find -mtime -1 | xargs scp ... user@remote:/dest/path



quick question on xargs --

how can you have xargs work with something like scp? the FINAL
arg to scp needs to be the destination; is there a way?

	find . | xargs cmd

does the same thing as

	cmd ./file1 ./file2 ./file3 ./file4

but i need it to do something like

	cmd ./file1 ./file2 ./file3 ./file4 DESTPATH

rtfm, i discovered the '--replace' (-i) item, thinking that

	xargs -i# command # suffix

would replace # with instances (filenames) from standard input,
as in

	command file1 file2 file3 suffix
	command file4 file5 suffix

so i try

	$ find . -type f -mtime -1 -print0 | xargs -0 -i# scp -p # me@host.lan:~office/
	usage: scp [-pqrvBC46] [-F config] [-S program] [-P port]
	           [-c cipher] [-i identity] [-o option]
	           [[user@]host1:]file1 [...] [[user@]host2:]file2
	usage: scp [-pqrvBC46] [-F config] [-S program] [-P port]
	           [-c cipher] [-i identity] [-o option]
	           [[user@]host1:]file1 [...] [[user@]host2:]file2

to figure out what's going on, i try

	find . -type f -mtime -2 -print0 | xargs -0 -i# echo # me@host.lan:~office/

and get a whole lotta blank lines. what did i miss?

-- 
I use Debian/GNU Linux version 2.2;
Linux server 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i586 unknown
 
DEBIAN NEWBIE TIP #22 from Will Trillich <will@serensoft.com>
:
SECURITY-CONSCIOUS? Good! Here's how you can use apt-get to keep
your system up-to-date with the latest security patches: in
/etc/apt/sources.list include these lines--
	deb http://security.debian.org/debian-security stable/updates main contrib non-free
	deb http://security.debian.org/debian-non-US stable/non-US main contrib non-free
	deb http://security.debian.org stable/updates main contrib non-free
Thereafter, a quick "apt-get update && apt-get upgrade" is all
you need to keep the gremlins at bay.

Also see http://newbieDoc.sourceForge.net/ ...



Reply to: