[TriLUG] Some script help

Matt Pusateri via TriLUG trilug at trilug.org
Tue May 12 16:54:06 EDT 2015


A lot simpler to just have find +mtime script prune the directory and rsync to transfer the files as someone else alluded to

Matt 

Sent from my iPhone

> On May 12, 2015, at 4:40 PM, Alan Porter via TriLUG <trilug at trilug.org> wrote:
> 
> 
> 
> 
>> Bash is fine for this, but the key is to not try to compare dates. Bash doesn't do that well at all.
> 
> If you must compare dates in bash, let the date command convert them for you.
> 
> echo $((  (  $(date -d '2015-05-12' +%s)  -  $(date -d '2014-05-12' +%s)  )  / 86400  ))
> 365
> 
> 
> Or if long lines are not your thing...
> 
> d1=$(date -d '2015-05-12' +%s)
> d2=$(date -d '2014-05-12' +%s)
> echo $(( ( $d1 -  $d2 ) / 86400 ))
> 365
> 
> 
> Alan
> 
> 
> 
> -- 
> This message was sent to: M. Pusateri <mpusateri at wickedtrails.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web    : http://www.trilug.org/mailman/options/trilug/mpusateri%40wickedtrails.com
> Welcome to TriLUG: http://trilug.org/welcome


More information about the TriLUG mailing list