ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: "Nikolay A. Fetisov" <naf@naf.net.ru>
To: community@altlinux.ru
Subject: Re: [Comm] Изменение расширения для большого количества файлов.
Date: Thu, 10 Mar 2005 20:22:10 +0300
Message-ID: <20050310202210.2154a429@naf177.naf.net.ru> (raw)
In-Reply-To: <4230457B.1080702@rambler.ru>

On Thu, 10 Mar 2005 15:02:51 +0200
Olvin <olvin@rambler.ru> wrote:

> Grigory Soloviov wrote:
> > Помогите с проблемой, есть ~50 Gb mp3 и какая-то часть из этих файлов 
> > имеет расширение "MP3", а не "mp3" чем усложняет создание плейлиста.
> > Помгите со скриптом, что бы перевести расширения всех файлов в 
> > нормальный вид т.е. "mp3".
> > Предвосхищая вопрос отвечаю, все копировалось с винды на linux.
> 
> #!/usr/bin/perl
> ..... 42 строки пропущено
> В качестве параметра принимает имя директории, имена файлов в которой 
> надо привести к нижнему регистру. Не только расширение, но всё (!!!) имя 
> файла!

Ой... Виноват, не удержался...
===========8<=============
#!/usr/bin/perl -w
use strict;

my $ext='.MP3';
my $old;

sub ren {
    chdir shift;
    for (<*>) {
	ren($_) if ( -d $_ );
	if ( -f $_ ) {
	    $old=$_;
	    rename $old, $_ if ($_=~s/($ext)$/\L$1/);
	    }
	}
    chdir '..';
    }

ren('.');
===========8<=============
Запускается из верхнего каталога с файлами. Проходит по всем 
подкаталогам, трогает только расширения файлов...


--
С уважением,
Николай Фетисов


  reply	other threads:[~2005-03-10 17:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-10 12:50 Grigory Soloviov
2005-03-10 12:57 ` Ivan Fedorov
2005-03-10 13:21   ` Grigory Soloviov
2005-03-10 13:46     ` Re[2]: " php-coder
2005-03-11  8:15       ` Grigory Soloviov
2005-03-11  8:35         ` Alexey I. Froloff
2005-03-11  3:33     ` Pyatnitskich Evgeniy
2005-03-11  8:28       ` Grigory Soloviov
2005-03-11  8:40         ` Alexey I. Froloff
2005-03-11  8:44         ` Pyatnitskich Evgeniy
2005-03-11 10:09           ` Olvin
2005-03-11  3:43     ` Pyatnitskich Evgeniy
2005-03-10 14:13   ` Re[2]: " php-coder
2005-03-10 14:24     ` Genix
2005-03-10 12:59 ` Andrei Popov
2005-03-10 13:02 ` Olvin
2005-03-10 17:22   ` Nikolay A. Fetisov [this message]
2005-03-11  8:36     ` Grigory Soloviov
2005-03-10 14:26 ` [Comm] " Arioch

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=20050310202210.2154a429@naf177.naf.net.ru \
    --to=naf@naf.net.ru \
    --cc=community@altlinux.ru \
    /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

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git