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

Re: compress files



Kelly Clowers wrote:
> tsitras@linuxmail.org wrote:
> > #!/bin.bash
> > FILES=`find . -mtime -30 | xargs`
> > tar --no-recursion -czf backup_feb_2013.tgz "${FILES}"
> > rm -rf "${FILES}"
> >
> >
> > the compressed files have the following format
> >
> > g303-20130205-060552-1360037152.419.wav
> >
> >
> > i am stuck on how to edit the script so it will automatically create the
> > month of the backup. Now the naming is manual.

I always use numbers for dated file timestamps.  That way they always
sort nicely.  I prefer the %F and %T formats.  But for a single date:

  touch test.$(date +%F)

> Date issues aside, I suggest compressing the .wav files with an audio
> codec. If you don't want to loose any information to a lossy codec,
> try FLAC. It is lossless like gzip, but it should give somewhat better
> compression than a non-audio-specific compressor. And of course
> something like vorbis on q4-q6 will give very good sound and give much
> smaller size, if you don't mind lossy.

Agreed!  Gzip won't do a very good job by comparison to audio and
video compressors on audio or video files.

I would create a helper script to do the compression and original file
removal.  It makes things simpler.  Then call it from find.

File wav2z or some such name.  Use 'oggenc' if you prefer instead of
'flac'.

  #!/bin/sh
  flac "$1" && rm "$1"

Call it from find.  No need for xargs.  Better without.

  find . -mtime $AGE -exec wav2z {} +

These can also be combined into a single find command but the nested
syntax makes it more complicated and easier to have error.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: