[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Split command wait - Request
From: |
Pádraig Brady |
Subject: |
Re: Split command wait - Request |
Date: |
Thu, 26 Apr 2012 12:24:28 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 04/26/2012 01:39 AM, Quinton Dunning wrote:
> To whom it may concern,
>
> Sometimes when I execute the split command I want to use removable media and
> take a file part over to another machine. To do this, the split command would
> have to have a switch that would pause and wait for a keystroke before
> writing the next file.
>
> I am not experienced with much programming at all and was thinking this would
> be a fantastic feature to add to split for anyone who can patch it in.
I sort of like this, but split would need two options to support it I think.
--target-directory # so split wouldn't have to run in the mounted dir
--confirm-create # wait for confirmation before creating a file
I suppose you could do this with a script like the following.
But that only works when we know the size of the input.
size=$(stat --format %s "$file")
media_size=$((2*1024**3))
chunks=$(($size/$media_size + 1))
chunk=1
while true; do
read -p "Press return to create ..."
(cd $dest &&
split -n $chunk/$chunks > $file.$chunk)
test $chunk = $chunks && break
chunk=$(($chunk+1))
done
cheers,
Pádraig.