Find the answer to your Linux question:
Results 1 to 2 of 2
Evening all, I am having some difficulty with a script that I need to create. I have a folder in a Red Hat system that contains wav files (alot of ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    6

    Script to create compressed archives base on dates in folder!!!

    Evening all,

    I am having some difficulty with a script that I need to create. I have a folder in a Red Hat system that contains wav files (alot of wav files) they have in their names a date format YYYYMMDD so I can search for them and then create a manual archive (tar.gz). The problem is their shear number of files dating back to early 2006 this would take an age.

    I basically need a script that will assess the folder based on dates and create an archive for each day of the year (or for each day that a wav file is present) of the wav files.

    In short put all wav files named *YYYYMMDD*.wav into YYYYMMDD.tar.gz for each collection of files dated *YYYYMMDD*.wav.

    Any help on this would be greatly appreciated.


  2. #2
    Just Joined!
    Join Date
    Sep 2007
    Posts
    6

    Smile Final Code!!

    This seems to do it, remove the echo to execute!!!! Many thanks to raskin.

    #!/bin/bash

    ls | sed -e 's/.*\([0-9]\{8,8\}\).*[.]wav/\1/' | sort | uniq | while read LINE
    do
    echo tar czf ${REPLY}.tar.gz *${REPLY}*
    done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...