View previous topic :: View next topic |
Author |
Message |
hellraiser Guru


Joined: 14 Jun 2003 Posts: 431 Location: Pescara [Italy]
|
Posted: Thu Jul 17, 2003 11:56 am Post subject: /bin/bash |
|
|
sentite...ho un urgente necessita di rinominare dei file jpg in ordine progressivo...tutti con lo stesso nome, pero con un numero progressivo
ex. photo_001.jpg
photo_002.jpg
photo_003.jpg
photo_004.jpg
ecc.
mi servirebbe un piccolo script bash...per poter far questo ed evitare che lo faccia io a mano sono piu di 1000 foto...
perfavore AIUTOOOOOO
thanks  _________________ Io non sono nessuno...ma nessuno è come me!
"Open Source is a good idea..." |
|
Back to top |
|
 |
hellraiser Guru


Joined: 14 Jun 2003 Posts: 431 Location: Pescara [Italy]
|
Posted: Thu Jul 17, 2003 12:16 pm Post subject: |
|
|
risolto con il perl
#!/usr/bin/perl
$my_dir = @ARGV[0] || die "Non è stata specificata la directory\n";
@files = `ls $my_dir`;
chop @files;
foreach $f(@files) {
$count++;
$f =~ /\.(.*)/;
rename("$my_dir/$f", "$my_dir/$count.$1");
}
addios  _________________ Io non sono nessuno...ma nessuno è come me!
"Open Source is a good idea..." |
|
Back to top |
|
 |
|