Arcade
Go Back   Anime Take Forums > AnimeTake > Support
Reload this Page Renaming a lot of files
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Creeper
 
itasha's Avatar
 
Join Date: Jan 2010
Location: N/A
Default Renaming a lot of files - 12-31-2010, 06:21 AM

Is there any way to rename a lot of files in increasing numerical order on Windows XP? For example, let's say I have 13 files with a file name "[Nutbladder]_Arakawa_Under_the_Bridge_2_-_XX", "XX" being the episode number. What I normally have to do is type in "Arakawa Under the Bridge 2 - XX" for one and then copy and paste that for each file. So I get:
Arakawa Under the Bridge 2 - 01
Arakawa Under the Brdige 2 - 02
Arakawa Under the Brdige 2 - 03 etc,etc,etc.

So, is there any way to select all the files in a group and make them number themselves?
Reply With Quote
  (#2 (permalink)) Old
Twinkle Twinkle
 
Darkchao45's Avatar
 
Join Date: Jul 2009
Location: Metiendo mano.
Send a message via MSN to Darkchao45
Default 12-31-2010, 07:20 AM

Highlight all your files, right click then press "rename" and type in the name of the file. Everything should have the same name but with parenthesis and increasing numerical numbers. For example...

Something
Something (2)
Something (3)

There's prolly another more specific method but this is all I know =/


Click the image to open in full size.
 
The list of peoples who made my sigs is gone, but thanks to all of them who took the time to make em for me <3

Click and join if you likes teh K-Pop and anything related!
[Only registered and activated users can see links. ]

MAL
[Only registered and activated users can see links. ]

tumblr
[Only registered and activated users can see links. ]

 
Click the image to open in full size.


Reply With Quote
  (#3 (permalink)) Old
lurklurklurk
 
Join Date: Sep 2009
Default 12-31-2010, 08:06 AM

If you feel like messing with a Python script, you can use this. I wrote it a while back to speed up renaming multiple anime videos. I use it on Linux and OS X, but if you have Python installed, it should work for Windows as well.

You can change some small bits at the bottom if you want to leave out the sub group or use spaces instead of underscores. It doesn't work every time, but it makes very good guesses, and it gives you the option to type the filename yourself if you don't like its guess.

Code:
#!/usr/bin/python

import sys, os, shutil, re

def padZeros(str, n):
  while len(str) < n:
    str = '0' + str
  return str

def identifySubGroup(name):
  begin = name.find('[')
  if begin < 0:
    return '' # none
  end = name.find(']', begin)
  if end < 0:
    return '' # odd filename
  return name[begin+1:end]

def lowerCaseParticles(name):
  particles = ['No', 'Wa', 'Ha']
  for p in particles:
    pattern1 = r' ' + p + ' '
    pattern2 = r' ' + p + '$'
    pattern = '(' + pattern1 + ')|(' + pattern2 + ')'
    rep = ' ' + p.lower() + ' '
    new_name = re.sub(pattern, rep, name)
    while name != new_name:
      name = new_name
      new_name = re.sub(pattern, rep, name)
  return name.strip()

def identifySeriesNumberMethod(name):
  matchObj = re.search(r'[\d]', name)
  if not matchObj:
    return name # assume whole name is the series name (movie, etc.)
  i = matchObj.start()
  return name[:i].strip()

def identifySeriesDashMethod(name):
  i = name.find(' - ')
  return name[:i].strip()

def identifySeries(name):
  ret = None
  if ' - ' in name:
    ret = identifySeriesDashMethod(name)
  else:
    ret = identifySeriesNumberMethod(name)
  pattern1 = r' [Ee][Pp] '
  pattern2 = r' [Ee][Pp]$'
  pattern = '(' + pattern1 + ')|(' + pattern2 + ')'
  ret = re.sub(pattern, '', ret)
  ret = lowerCaseParticles(ret)
  return ret

def identifyEpisodeNumberMethod(name):
  matchObj = re.search(r'[\d][\d]*', name)
  if not matchObj:
    return '' # assume movie, etc.
  i = matchObj.start()
  j = matchObj.end()
  return name[i:j].strip()

def identifyEpisodeDashMethod(name):
  i = name.find(' - ')
  j = len(name)
  return name[i+3:j].strip()

def stripParentheses(s):
  while '(' in s:
    i = s.find('(')
    j = s.find(')')
    s = s[:i] + s[j+1:]
  return s

def identifyEpisode(name):
  ret = None
  if ' - ' in name:
    ret = identifyEpisodeDashMethod(name)
  else:
    ret = identifyEpisodeNumberMethod(name)
  ret = stripParentheses(ret)
  ret = ret.replace('v2', '')
  if len(ret) > 0:
    ret = padZeros(ret, 2)
  ret = ret.strip()
  return ret

def stripTags(name): # must call AFTER identifySubGroup
  begin = name.find('[')
  while begin >= 0:
    end = name.find(']', begin)
    if end < 0:
      break # odd filename
    before = ''
    if begin != 0:
      before = name[:begin]
    after = name[end+1:]
    name = before + after
    name = name.strip()
    begin = name.find('[')
  return name

def addSubbers(name, subbers):
  if len(subbers) > 0:
    name += ' [' + subbers + ']'
  return name

def addEpisode(name, episode):
  if len(episode) > 0:
    name += ' - ' + episode
  return name

if len(sys.argv) < 2 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
  print "usage: smart_rename FILE [FILE...]"
  sys.exit(1)

for file in sys.argv[1:]:

  old_file = file

  (name, ext) = os.path.splitext(file)
  ext = ext.lower()

  name = name.replace('_', ' ') # spaces are easier to work with strip(), etc.
  subbers = identifySubGroup(name)
  name = stripTags(name)
  series = identifySeries(name)
  episode = identifyEpisode(name)

  name = series
  name = addEpisode(name, episode)
  name = addSubbers(name, subbers)
  name = name.replace(' ', '_') # we want '_' in the end

  final_name = name + ext

  if old_file == final_name:
    continue

  print "moving " + old_file + " to " + final_name
  ans = raw_input('Continue? (Y/n) ')
  if ans.strip().lower() in ['y', 'yes'] or not ans.strip():
    pass
  else:
    ans = raw_input('Enter new name or blank to skip: ')
    if not ans.strip():
      print "skipping " + old_file
      continue
    final_name = ans.strip()
  shutil.move(old_file, final_name)
Reply With Quote
  (#4 (permalink)) Old
Drill Master
 
UnknownFact2's Avatar
 
Join Date: Dec 2009
Location: Floating around Algorithmic Compounds.
Default 12-31-2010, 08:07 AM

^that is win ldb88.


Click the image to open in full size.
( Click to show/hide )


Now you should ALL go watch this movie "Tangshan Dadizhen" (or "Aftershock" in English) right now. NOW.

Finally, a pic.
( Click to show/hide )

Click the image to open in full size.

Download here:
( Click to show/hide )

[Only registered and activated users can see links. ]


( Click to show/hide )



Reply With Quote
  (#5 (permalink)) Old
lurklurklurk
 
Join Date: Sep 2009
Default 12-31-2010, 08:12 AM

Thanks
Reply With Quote
  (#6 (permalink)) Old
Otaku
 
leo_ck's Avatar
 
Join Date: Jan 2009
Default 12-31-2010, 08:24 AM

Quote:
Originally Posted by itasha View Post
Is there any way to rename a lot of files in increasing numerical order on Windows XP? For example, let's say I have 13 files with a file name "[Nutbladder]_Arakawa_Under_the_Bridge_2_-_XX", "XX" being the episode number. What I normally have to do is type in "Arakawa Under the Bridge 2 - XX" for one and then copy and paste that for each file. So I get:
Arakawa Under the Bridge 2 - 01
Arakawa Under the Brdige 2 - 02
Arakawa Under the Brdige 2 - 03 etc,etc,etc.

So, is there any way to select all the files in a group and make them number themselves?
Oh.. that's a good ques... I got a good solution for u.... You can either follow their advices and use the Python, Command Prompt or the traditional Windows Explorer way (But this will form "Arakawa Under the Bridge 2 - 0(1)" instead of what you actually want)

To do what you actually want it's better to get an external program.
It's called Renamer.
[Only registered and activated users can see links. ]

It's a small, simple and fast program to use.
It gives you the option to Insert, Delete, Remove, Replace, Rearrange, Extension, Strip, Case, Serialize (Means numbering themselves), Cleanup (removes _ %20 . - + etc) and more.

If you don't know how to use it then you can ask me


[Only registered and activated users can see links. ]
Reply With Quote
  (#7 (permalink)) Old
duh duh is offline
Shotacon
 
duh's Avatar
 
Join Date: Aug 2009
Location: Any place where there are rainbows.
Default 12-31-2010, 08:43 AM

Edit: leo_ck beat me to it. Oh well.

Try using something like [Only registered and activated users can see links. ].

Add a CleanUp rule and tick the boxes for (...), [...] and _, so it looks like this:

[Only registered and activated users can see links. ]

Go to Settings > All Settings (F8) and tick Save rules configuration on exit, load on startup:

[Only registered and activated users can see links. ]

The main window will look like this:

[Only registered and activated users can see links. ]

Either drag a load of files into the bottom section or click the Add Files/Folders button, hit Preview, have a look through the New Name column and make sure everything looks OK and then just click Rename.

The good thing with this method is that it works with pretty much any anime file, as the majority of groups use [] or () brackets.
Reply With Quote
  (#8 (permalink)) Old
Creeper
 
itasha's Avatar
 
Join Date: Jan 2010
Location: N/A
Default 12-31-2010, 09:11 AM

Thanks everyone, hopefully I can save some time in the future. It's not so bad with 12-13 episode seasons, but with something like FMA or Kiba, assistance is required.


Click the image to open in full size.
( Click to show/hide )
Thanks to Weika for this sig!
Reply With Quote
  (#9 (permalink)) Old
Twinkle Twinkle
 
Darkchao45's Avatar
 
Join Date: Jul 2009
Location: Metiendo mano.
Send a message via MSN to Darkchao45
Default 12-31-2010, 09:50 AM

Wow my method looks like crap compared to the methods other people posted T_T

But this is good cause I now know new methods too :3


Click the image to open in full size.
 
The list of peoples who made my sigs is gone, but thanks to all of them who took the time to make em for me <3

Click and join if you likes teh K-Pop and anything related!
[Only registered and activated users can see links. ]

MAL
[Only registered and activated users can see links. ]

tumblr
[Only registered and activated users can see links. ]

 
Click the image to open in full size.


Reply With Quote
  (#10 (permalink)) Old
Banned
 
Join Date: Jan 2010
Location: Between the montains homework.
Unhappy 12-31-2010, 10:32 AM

Quote:
Originally Posted by Darkchao45 View Post
Highlight all your files, right click then press "rename" and type in the name of the file. Everything should have the same name but with parenthesis and increasing numerical numbers. For example...

Something
Something (2)
Something (3)

There's prolly another more specific method but this is all I know =/
Yeah, it would be handy, if the files aren't switched.
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump