From: Francisco Ares <frares@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Changing names of LOTS of files, adding to them actually.
Date: Thu, 1 Dec 2011 00:19:27 -0200 [thread overview]
Message-ID: <CAHH9eM6cb_JwocfBpW=HpTB9KfvPKn0n9AFbmB--OTKAh=SiuA@mail.gmail.com> (raw)
In-Reply-To: <4ED6DD26.1070604@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2701 bytes --]
I use the following script to remove parts of downloaded videos, I guess it
wont't be hard to figure out how to change it to your needs. It also
creates a text file with the name of the file and, expecting it to be a
video file, it uses midentify, part of the mplayer package, to read the
duration of the video in a form that LibreOffice is able to import directly.
#! /bin/bash
for i in *unwantedString.??? # it can be a MP4 or a FLV
do
if [ "$i" != "*unwantedString.???" ] # this checks if the list is empty
then
j=`echo $i | sed s/\ \-\ unwantedString//`
# echo $j
mv "$i" "$j"
fi
done
for i in *.mp4 *.flv # this removes duplicated file extension
do
if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ]
then
j=`echo $i | sed -e s/\.mp4\.mp4/\.mp4/ -e s/\.flv\.flv/\.flv/`
# echo $j
if [ "$i" != "$j" ]
then
mv "$i" "$j"
fi
fi
done
if [ -e contents.txt ]
then
rm contents.txt
fi
for i in *.mp4 *.flv
do
if [ "$i" != "*.mp4" ] && [ "$i" != "*.flv" ]
then
j=`midentify "$i" | grep ID_LENGTH | cut -d\= -f 2`
k=`echo $i | sed -e s/\.mp4//g -e s/\.flv//g`
echo -e $k \\t 00:00:`echo $j | cut -d\. -f1`,`echo $j | cut -d \.
-f2` >> contents.txt
fi
done
Hope it helps
Francisco
On Wed, Nov 30, 2011 at 11:49 PM, Dale <rdalek1967@gmail.com> wrote:
> Greets,
>
> I ran into a problem. I been downloading a lot of TV shows. I forgot to
> put a sort of important part in the names. This is what I have with the
> full path:
>
> /data/Movies/TV_Series/Person of Interest/Season 1, Episode 1 - Pilot.mp4
>
> This is what I need it to be:
>
> /data/Movies/TV_Series/Person of Interest/Person of Interest - Season 1,
> Episode 1 - Pilot.mp4
>
> Basically, I need to add the name of the show to the name of the file.
> They will all be added to the front of the names. They also almost all
> contain spaces, which means some fancy footwork with the \.
>
> Is there a way to do this? I have room to copy them to another directory
> if needed. I would sort of actually prefer it that way since if it messes
> up, I got the originals at least.
>
> Sorry I'm not real good at gawk, sed and all those things. I suspect
> those will be used tho. I am familiar with | and grep tho. ;-)
>
> Thoughts?
>
> Dale
>
> :-) :-)
>
> --
> I am only responsible for what I said ... Not for what you understood or
> how you interpreted my words!
>
>
>
--
"If you have an apple and I have an apple and we exchange apples then you
and I will still each have one apple. But if you have an idea and I have
one idea and we exchange these ideas, then each of us will have two ideas."
- George Bernard Shaw
[-- Attachment #2: Type: text/html, Size: 3908 bytes --]
next prev parent reply other threads:[~2011-12-01 2:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 1:49 [gentoo-user] Changing names of LOTS of files, adding to them actually Dale
2011-12-01 2:18 ` Frank Steinmetzger
2011-12-01 2:46 ` Dale
2011-12-01 2:19 ` Francisco Ares [this message]
2011-12-01 2:23 ` Francisco Ares
2011-12-01 2:22 ` Pandu Poluan
2011-12-01 2:29 ` Pandu Poluan
2011-12-01 2:22 ` bill.longman
2011-12-01 3:23 ` Frank Steinmetzger
2011-12-01 4:18 ` Dale
2011-12-01 8:53 ` Neil Bothwick
2011-12-01 9:34 ` Stroller
2011-12-01 10:42 ` Dale
2011-12-01 15:29 ` Frank Steinmetzger
2011-12-02 17:33 ` James Broadhead
2011-12-02 10:50 ` Stroller
2011-12-02 15:43 ` Frank Steinmetzger
2011-12-01 10:55 ` Helmut Jarausch
2011-12-01 13:22 ` James Broadhead
2011-12-01 13:51 ` Paul Hartman
2011-12-02 10:21 ` Stroller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHH9eM6cb_JwocfBpW=HpTB9KfvPKn0n9AFbmB--OTKAh=SiuA@mail.gmail.com' \
--to=frares@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox