(strictly my opinion)

I think you'd be better off to write a script where you can check the 
return code of scp, otherwise, sooner or later you're automated code is 
bound to sooner or later delete a file you don't want deleted.

Another good reason is the fact that Bash can mishandle multiple 
commands in a single command-line.  I can't give you specifics off the 
top of my head, I just remember the problems are there so it's good to 
beware and write a script for anything more than a clean task you're 
sure can work in a single command-line.  Also, the script will have its 
own shell copy, so if anything goes wrong, you don't risk your top level 
shell crashing or having variables/functions/aliases, etc. changed that 
you don't want changed.

J.T.F. wrote:
> to also delete the file that was sent, I'll assume that you would do
>
> for file in *.txt; do scp *.txt u...@server:/path/to/directory/.; rm -
> f *.txt; done
>
> This folder will be actively having more files dropped into it.  I
> don't want to accidentally delete a file that wasn't scp'd.
>
> Thanks
>
>
>
> On Oct 5, 3:15 pm, hard wyrd <[email protected]> wrote:
>   
>> for file in *.txt; do scp *.txt u...@server:/path/to/directory/.; done
>>
>> On Tue, Oct 6, 2009 at 2:24 AM, JTF <[email protected]> wrote:
>>
>>     
>>> This will probably be a no-brainer for many here;
>>>       
>>> Is it possible to do this in a single line of code?
>>>       
>>> Find any .txt files
>>> SECURE copy (scp) them to another sytem
>>> delete the file
>>>       
>>> Thanks
>>> JEFF
>>>       
>> --
>> Penguin, penguin, and more penguin.
>>
>> Believe that within the brain is a brain, and within it another brain, and
>> so on and so forth.
>>     
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
-~----------~----~----~----~------~----~------~--~---

Reply via email to