[GRLUG] need some script help

Dave Chiodo megadave at gmail.com
Thu Apr 18 10:53:03 EDT 2013


Best to test.

As Michael suggested, use "echo" in place of the "mv" to see what will happen.

I might suggest you get in the habit of normalizing filenames of stuff
you download to avoid spaces and other "special" characters that can
cause problems.

There are various utilities than can help with that - search on google.


On Thu, Apr 18, 2013 at 10:47 AM, Jonathan Jesse <jjesse at gmail.com> wrote:
> Yeah most of them have space in them so would either one work?
>
> Thanks for the quick response guys :)
>
>
> On Thu, Apr 18, 2013 at 1:08 AM, Dave Chiodo <megadave at gmail.com> wrote:
>>
>> Gotta be wary of filenames with spaces though.
>>
>> For instance, if files were
>>
>> Movie1.mp4
>> Long Movie.mp4
>>
>> A for-loop on that could easily end up doing:
>>
>> mv Movie1.mp4 Movie1.avi
>> mv Long Long
>> mv Movie.mp4 Movie.avi
>>
>> Also gotta watch for .mp4 vs .MP4 - windows f/s are not case
>> sensitive, but *nix are.
>>
>> Movie.mp4 and Movie.MP4 are two different files on a *nix system and
>> MOVIE.mp4 is yet a third.
>>
>> As far as WHY the xbox doesn't work when the file is called mp4 and
>> does when its avi, its due to MS foolish use of file extensions
>> instead of contents of the file or something more standard to
>> determine what the type of data is.
>>
>> For a really long explanation of the issues, that is written from a
>> Mac perspective (OSX is *nix), see
>> http://arstechnica.com/apple/2001/08/metadata/
>>
>> (Sadly, its one of those spread-across-multiple-pages aticles and I
>> couldn't find a one-page version of it. Its also quite old, but its
>> points are still valid, even if they are now forgone lost-causes)
>>
>> On Thu, Apr 18, 2013 at 12:39 AM, Michael Glaske <mglaske at gmail.com>
>> wrote:
>> > This should work..  beware though.. It's untested.. in BASH.
>> >
>> > for file in `find . -name \*.mp4`; do mv $file `echo $file | sed
>> > 's/\(.*\.\)mp4/\1avi/'` ; done
>> >
>> > If you want to test it first, replace 'mv $file' with 'echo'.
>> >
>> >
>> > On Wed, Apr 17, 2013 at 10:39 PM, Jonathan Jesse <jjesse at gmail.com>
>> > wrote:
>> >>
>> >> Hey GRLUGERS,
>> >>
>> >> New to scripting and all that but hoping to get some help out here.
>> >> I've
>> >> been using minidnla on my Ubuntu laptop to stream movies to my xbox and
>> >> things are working very well.
>> >>
>> >> However I notice something... If I grab something off bittorent chances
>> >> are it is a MP4 or a MKV file and my xbox can't stream it.
>> >>
>> >> For some reason if I rename the same file Big Bang Theory.mp4 to Big
>> >> Bang
>> >> Theory.avi the file will play on my xbox.  Not quite sure what happens
>> >> in
>> >> the rename of the file that makes the magic work but it does.
>> >>
>> >> So I'm wondering if there is a script guru that could look at all my
>> >> files
>> >> that either named *.mp4 or *.mkv and rename it to whatever it was .avi?
>> >>
>> >> Make sense?
>> >>
>> >> _______________________________________________
>> >> grlug mailing list
>> >> grlug at grlug.org
>> >> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug
>> >
>> >
>> >
>> > _______________________________________________
>> > grlug mailing list
>> > grlug at grlug.org
>> > http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug
>> _______________________________________________
>> grlug mailing list
>> grlug at grlug.org
>> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug
>
>
>
> _______________________________________________
> grlug mailing list
> grlug at grlug.org
> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug


More information about the grlug mailing list