The time now is Sat 18 May 2013, 21:40
All times are UTC - 4 |
|
Page 2 of 2 [23 Posts] |
Goto page: Previous 1, 2 |
| Author |
Message |
WillM
Joined: 30 Dec 2009 Posts: 99 Location: Oakland, California
|
Posted: Thu 26 Apr 2012, 01:23 Post subject:
|
|
@shoutcrown
HI; While my previous script may work, it is clunky and round about. So I did a Google search. Just need to rename the file like normal then increment numerically. So here is the streamlined script
| Code: |
#!/bin/bash
for i in *.mp3; do let j+=1 ; mv "$i" multimedia-$j.mp3 ; done
|
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1696 Location: Burghaslach, Germany
|
Posted: Thu 26 Apr 2012, 04:56 Post subject:
How to rename many files to a unique name? Subject description: streamlined |
|
| Quote: | | j=0; for i in *.mp3; do let j+=1 ; mv "$i" multimedia-$j.mp3 ; done |
allows repetitions (and another start number)
|
|
Back to top
|
|
 |
musher0

Joined: 04 Jan 2009 Posts: 2193 Location: Gatineau (Qc), Canada
|
Posted: Thu 26 Apr 2012, 13:43 Post subject:
Re: How to rename many files to a unique name? Subject description: streamlined |
|
| L18L wrote: | | Quote: | | j=0; for i in *.mp3; do let j+=1 ; mv "$i" multimedia-$j.mp3 ; done |
allows repetitions (and another start number) |
Elegant!
_________________
"...l'industrie de l'informatique n'aura besoin que de très peu de temps pour ramener l'humanité aux dessins rupestres." (M. Goebbel, Order of the Command Line; [ma trad.])
|
|
Back to top
|
|
 |
shoutcrown
Joined: 12 Mar 2011 Posts: 77
|
Posted: Fri 27 Apr 2012, 00:24 Post subject:
AGAIN! Subject description: HELLO! |
|
Hi guys!
WillM, previous method was OK, and the new you give it works too (What do you mean exactly? (Is the previous method worse than the new?)
L18L, a single line works too! Very Good!
Those methods you give me are excellent, but You know?, there is an issue when there are more than 10 files:
For example if the names are already numbered: landscape-1, landscape-2,..., landscape-10, landscape-11, Then, when I rename them to "paisaje", the files landscape-10, landscape-11, becomes paisaje-1, paisaje-2, and continue the other files like paisaje-3, paisaje-4,...
So, How to keep the order and rename the files?
Muchas gracias!
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1696 Location: Burghaslach, Germany
|
Posted: Fri 27 Apr 2012, 04:43 Post subject:
Re: AGAIN! Subject description: HELLO! |
|
| shoutcrown wrote: | ...
Those methods you give me are excellent, but You know?, there is an issue when there are more than 10 files:
For example if the names are already numbered: landscape-1, landscape-2,..., landscape-10, landscape-11, Then, when I rename them to "paisaje", the files landscape-10, landscape-11, becomes paisaje-1, paisaje-2, and continue the other files like paisaje-3, paisaje-4,... |
Then you have done something else than just rename.
| Code: | | j=0; for i in *; do let j+=1 ; mv "$i" paisaje-$j ; done |
# ls
paisaje-1 paisaje-11 paisaje-2 paisaje-4 paisaje-6 paisaje-8
paisaje-10 paisaje-12 paisaje-3 paisaje-5 paisaje-7 paisaje-9
#
This code did not rename but give new name and number starting from 1
I think that don570´s utility rename-files could be the right tool for you
|
|
Back to top
|
|
 |
shoutcrown
Joined: 12 Mar 2011 Posts: 77
|
Posted: Fri 27 Apr 2012, 09:43 Post subject:
HOLA! Subject description: HOLA! |
|
Hi L18L!
You know? I prefer the codes. The "trouble" I describe only appears when there is numbering. thank you anyway for Don570's utility
BYE!
|
|
Back to top
|
|
 |
don570

Joined: 10 Mar 2010 Posts: 2457 Location: Ontario
|
Posted: Sat 28 Apr 2012, 11:54 Post subject:
rename-files |
|
A useful feature of rename-files that people don't appear to
understand is
Move files with EXTENSION to their own folder
I'll explain in English why this is useful...
Let's say you have a folder with many different file formats inside,
but you want your mp3's to be alone in one folder.
Just fill in 'mp3' in field and the application does the work of
moving. There will be a folder created with the mp3 files inside.
Once this is done you can then number your mp3 files
with another feature of rename-files
Number files in folder from 000 to 999 according to date
This will put a number at the tail end of the filename.
The number will help the user to spot the files that are older.
_________________________________________________
|
|
Back to top
|
|
 |
shoutcrown
Joined: 12 Mar 2011 Posts: 77
|
Posted: Mon 30 Apr 2012, 02:03 Post subject:
THANKS! Subject description: GRACIAS |
|
hi don570!
Well, you know?, if rename-files can move a specific kind of files to an new directory is good, also it can number the files according to date.
Maybe I preferred the terminal method because at once I can give a new name and a number to the files.
Thank you for explaining the features of rename-files. bye
|
|
Back to top
|
|
 |
|
|
Page 2 of 2 [23 Posts] |
Goto page: Previous 1, 2 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|