Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] deleting a local list of filenames from remote server
- Date: Wed, 3 Dec 2008 09:29:07 -0600
- From: "Daniel A. Ramaley" <daniel.ramaley@example.com>
- Subject: Re: [tlug] deleting a local list of filenames from remote server
- References: <4935289F.4090309@jj.em-net.ne.jp> <11380cb60812021712n708f3dd9v2f62a8e7ee4e9861@mail.gmail.com>
- User-agent: KMail/1.9.5
On Tuesday December 2 2008 19:12, Clemens Schwaighofer wrote: >I do this in one of my scripts > >scp $delete_list target_user@example.com:~; >ssh -f target_user@example.com "cat ~/$delete_list_file | xargs rm -fv" Are $delete_list and $delete_list_file the same? From your usage, i'm going to assume they are, but if not, then please disregard everything else i say below. While what you have should work (though i'm not sure what the "-f" is being used for), rewriting it a bit would have 2 advantages. Namely, that only one ssh connection would be required (your commands use 2) thus giving you a performance improvement, and it would not leave a copy of $delete_list on the server. Here's how i'd rewrite it: cat $delete_list | ssh -f target_user@example.com 'xargs rm -fv' If you're one of those people who are bothered by superfluous uses of "cat", then it can be made (slightly) shorter, but in my humble opinion, less clear to read: ssh -f target_user@example.com 'xargs rm -fv' < $delete_list Note that in the case that $delete_list is not a static file, but is being generated by the standard output of $some_program, you could use a variation of my first syntax to never use a temporary file at all: $some_program | ssh -f target_user@example.com 'xargs rm -fv' ------------------------------------------------------------------------ Dan Ramaley Dial Center 118, Drake University Network Programmer/Analyst 2407 Carpenter Ave +1 515 271-4540 Des Moines IA 50311 USA
- Follow-Ups:
- Re: [tlug] deleting a local list of filenames from remote server
- From: Clemens Schwaighofer
- References:
- [tlug] deleting a local list of filenames from remote server
- From: Charles Muller
- Re: [tlug] deleting a local list of filenames from remote server
- From: Clemens Schwaighofer
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] deleting a local list of filenames from remote server
- Next by Date: Re: [tlug] deleting a local list of filenames from remote server
- Previous by thread: Re: [tlug] deleting a local list of filenames from remote server
- Next by thread: Re: [tlug] deleting a local list of filenames from remote server
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links