Re: compress files
On Tue, Feb 19, 2013 at 09:24:23AM -0500, tsit...@linuxmail.org wrote: hello fellas. i was looking for a way to compress files (.wav) older than 30 days. Fellas and Dames, if you please. i created a small script to do the job. [cut] any suggestions please? man date signature.asc Description: Digital signature
Re: compress files
On 19/02/13 14:24, tsit...@linuxmail.org wrote: any suggestions please? Have a look at the output of date --help, under the FORMAT section. You want something like date +%b to get Feb. You might also consider naming the files year-numerical_month to make sorting easier later. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/51238d7a.7070...@deathbycomputers.co.uk
Re: compress files
Le Mar 19 février 2013 15:24, tsit...@linuxmail.org a écrit : hello fellas. i was looking for a way to compress files (.wav) older than 30 days. i created a small script to do the job. #!/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. any suggestions please? = MONTH=`date +%B` echo $MONTH = This gives the whole month's name. Use %b to have an abbreviated one (here, i have février for first, and févr. for second. As it is localized, I have no clue about what you will have). the `...` is used to execute the content instead of simply using it as a string. Note, that this notation is the /bin/sh 's one, it works with bash, and *should* be relatively portable. Unlike the new one (which I do not remember anyway). -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/3f8e5bca20db6973872c6ed6d5754cc9.squir...@www.sud-ouest.org
Re: compress files
Le Mar 19 février 2013 15:37, Darac Marjal a écrit : On Tue, Feb 19, 2013 at 09:24:23AM -0500, tsit...@linuxmail.org wrote: Fellas and Dames, if you please. [cut] man date I must admit, I prefer having dates with Dames than with Fellas :D -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/767840de8edfb95fda0cf484febb2f6f.squir...@www.sud-ouest.org
Re: compress files
On Tue, Feb 19, 2013 at 6:24 AM, tsit...@linuxmail.org wrote: hello fellas. i was looking for a way to compress files (.wav) older than 30 days. i created a small script to do the job. #!/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. 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. Cheers, Kelly Clowers -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAFoWM=9od2xval4j_nkvzwcvobnfjucubcnusch5bgmur8y...@mail.gmail.com
Re: compress files
Kelly Clowers wrote: tsit...@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 signature.asc Description: Digital signature
Re: compress files
Bob Proulx wrote: 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. Or a goofy error like mine above. Drat. The wav2z scriptlet is only set up for exactly one argument but my use of '+' will had it all (as many as possible) files at once. That won't work. Either a for loop in the script OR use a ';' in the find command. At this point I will cowardly suggest the ';' to force one file at a time. It is simpler. find . -mtime $AGE -exec wav2z {} ';' I should have said I didn't test any of the above. Which is why goofy errors appear. Untested code is almost always buggy. Bob signature.asc Description: Digital signature
Re: compress files
If there really is the need to compress audio data, then + 1 for lossless codecs and if I need a simple date output e.g. to dump freebsd, I'm using dumpstart=$(date +%Y%m%d_%H%M%S) but with date you can do nice things, when using UNIX time, that aren't that simple too. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/op.wsrqrbxfqhadp0@freebsd