Ducati Sporting Club UK
Idle Chat
Still needs to be clean and of value to the club.
 
 
Thread Tools Display Modes
  #1  
Old 09-Nov-2006, 13:16
MJS's Avatar
DSC Member MJS MJS is offline
DSC Membership Sec. & BHCN R.O.
Webteam
Big Twin
Bikes: None at the moment
 
Posts: 1,948
Join Date: Jul 2003
Mood: Feeling old...
Help - renaming files

Guys

As a useful source of information on all things.... I thought I'd try asking this here...

We have to rename a whole bunch of files - somewhere in the region of 7500 to be precise. But, we need to retain the original name and append a revision number to them, so AB12345.xyz would become AB12345rev1.xyz

Is there an easy way of doing this? Any useful little power tool that can be downloaded and used for it?

Thanks for any advice - don't want to have to get someone to go through and rename them all manually

Cheers
Martin
Quote+Reply
  #2  
Old 09-Nov-2006, 13:21
Red-Duc's Avatar
Red-Duc Red-Duc is offline
Registered Forum User
Mille
 
Posts: 389
Join Date: May 2006
Dont know much about this really but Can you not just save a copy of the files into another folder and call it revisions,
Quote+Reply
  #3  
Old 09-Nov-2006, 13:27
MJS's Avatar
DSC Member MJS MJS is offline
DSC Membership Sec. & BHCN R.O.
Webteam
Big Twin
Bikes: None at the moment
 
Posts: 1,948
Join Date: Jul 2003
Mood: Feeling old...
Quote:
Originally Posted by Red-Duc
Dont know much about this really but Can you not just save a copy of the files into another folder and call it revisions,

No, it's to send to a sub-contractor, and with several thousand files floating about, they will inevitably get mixed up... and contractually we're obliged to name the files as such...
Quote+Reply
  #4  
Old 09-Nov-2006, 13:33
Red-Duc's Avatar
Red-Duc Red-Duc is offline
Registered Forum User
Mille
 
Posts: 389
Join Date: May 2006
well I hope someone can come up with an answer for you, I wouldnt fancy that job of renaming them all individually
Quote+Reply
  #5  
Old 09-Nov-2006, 13:34
antonye's Avatar
DSC Member antonye antonye is offline
Administrator
Webteam
MotoGP God
Bikes: 748S, HM1100S, V4SP, Was: DD-A #111
 
Posts: 13,080
Join Date: Feb 2002
Mood: Passion Killer
Save this as "rename.vbs" in the target directory.

Edit it so that the sPath is the name of the folder, and the sExt
is the name of the extension you wish to check (to filter for
just .gif files, for example).


Double click it in Windows Explorer and it should do the trick.


-- 8< -- cut here -- 8< --


sPath = "c:\temp\folder\"
sExt = ".gif"


Set fsoObject = CreateObject("Scripting.FileSystemObject")
Set fsoFolder = fsoObject.GetFolder(sPath)
for each fsoFile in fsoFolder.Files
if (Right(fsoFile.Name, Len(sExt)) = sExt) then
sNewName = Replace(fsoFile.Name, ".", "_rev1.")
fsoFile.Name = LCase(sNewName)
end if
next
Set fsoFolder = Nothing
Set fsoObject = Nothing


I'd rather die peacefully in my sleep like my Grandfather,
than screaming in terror like his passengers.- Jim Harkins

Ducati 748S | Ducati Hypermotard 1100S | Ducati Panigale V4 SP #876 | 600-620SS DesmoDue Racebike #111 <-- Sold!!

Last edited by antonye : 09-Nov-2006 at 13:37.
Quote+Reply
  #6  
Old 09-Nov-2006, 13:41
phil_h's Avatar
phil_h phil_h is offline
Registered Forum User
Ducati Meccanica
 
Posts: 2,527
Join Date: Sep 2004
Mood: 900,900,851,750,750,750, 600,600,450,350,350,250
Nice idea antony.
Be brave martin, he's teaching you how to use script files

BUT !!!
test it out on something simple first
Quote+Reply
  #7  
Old 09-Nov-2006, 13:50
MJS's Avatar
DSC Member MJS MJS is offline
DSC Membership Sec. & BHCN R.O.
Webteam
Big Twin
Bikes: None at the moment
 
Posts: 1,948
Join Date: Jul 2003
Mood: Feeling old...
Quote:
Originally Posted by antonye
Save this as "rename.vbs" in the target directory.

Edit it so that the sPath is the name of the folder, and the sExt
is the name of the extension you wish to check (to filter for
just .gif files, for example).


Double click it in Windows Explorer and it should do the trick.


-- 8< -- cut here -- 8< --


sPath = "c:\temp\folder\"
sExt = ".gif"


Set fsoObject = CreateObject("Scripting.FileSystemObject")
Set fsoFolder = fsoObject.GetFolder(sPath)
for each fsoFile in fsoFolder.Files
if (Right(fsoFile.Name, Len(sExt)) = sExt) then
sNewName = Replace(fsoFile.Name, ".", "_rev1.")
fsoFile.Name = LCase(sNewName)
end if
next
Set fsoFolder = Nothing
Set fsoObject = Nothing

Cheers for that.... as Phil says, I'll try it on something simple first.....!

Martin
Quote+Reply
  #8  
Old 09-Nov-2006, 13:39
Gizmo Gizmo is offline
Registered Forum User
Big Twin
 
Posts: 1,549
Join Date: Mar 2005
Mood: is it the weekend yet??
if you can't find a windoze program copy the files onto a mac and run the automater action "rename finder items", select "add text", "after name" add rev1 and it'll batch rename them for you, you can create a copy if you don't want to rename the original files.
Quote+Reply
  #9  
Old 09-Nov-2006, 14:21
748mart 748mart is offline
Registered Forum User
Mille
 
Posts: 268
Join Date: Jul 2001
whats wrong with good old dos

ren *.* *rev1.*
Quote+Reply
  #10  
Old 09-Nov-2006, 23:31
moto748 moto748 is offline
Registered Forum User
Big Twin
 
Posts: 1,385
Join Date: Apr 2004
Quote:
Originally Posted by 748mart
whats wrong with good old dos

ren *.* *rev1.*


That's just what I was going to say!

I often use DOS or, as it's seems to be known now, Command Prompt (I know it's not exactly the same thing, but it doesn't make any practical difference) to rename and search for files.
Quote+Reply
  
Thread Tools
Display Modes
Postbit Selector
Switch to Vertical postbit Use Vertical Postbit

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Recent Posts - Contact Us - DSC Home - Archive - Top
Powered by vBulletin 3.5.4 - Copyright © 2000 - 2025, Jelsoft Enterprises Ltd. - © Ducati Sporting Club UK - All times are GMT +1. The time now is 00:02.