[Top][All Lists]

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

Re: [Findutils-patches] xargs problem

From: Bernhard Voelker
Subject: Re: [Findutils-patches] xargs problem
Date: Tue, 20 Dec 2016 15:01:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 12/20/2016 01:30 PM, aws backup wrote:
> Hi Berny,
> thank you so much for your help.
>> First of all, I suggest to put everything you want to have in the
>> screen(1) session into a shell script.
> I tried this first but I could not figure out how to transfer the xargs 
> arguments to the script.
> For example:
> *fswatch -0 -Ie ".*\.*$" -i ".*\.mp4$" /path/to/folder | xargs -0 -n 1 -I {} 
> /path/to/*
> *s3cmd put {} s3://bucket/*
> I get following failure message:
> *ERROR: Parameter problem: Nothing to upload.*
> *
> So I get stuck already on the first point. 
> Sorry I am a beginner in shell scripting.
> How do I get it into the script?

If I understood your code well enough, then you just need to pass the
files found by fswatch to the following (untested) shellscript:

  filename="$(basename "$1")"
  terminal-notifier -message "s3cmd Upload '$filename' started"

  s3cmd put "$1" s3://bucket/ 2>&1 \
    | tee /path/to/logfile \
    |     >(mail -s "Upload '$filename'" address@hidden) \
        && terminal-notifier -message "s3cmd Upload of '$filename' done"

I also removed the redundant invocation of the 2nd tee(1) in the above.

Then you could the following command into another schell script
which you could then pass on the "script -dmS ...."

  $ fswatch -0 -Ie '.*\.*$' -i '.*\.mp4$' /path/to/folder \
      | xargs -0 -n 1 /path/to/

Of course, "set -x" and "xargs -t" are your friends here, too. ;-)

Have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]