INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Batch removal of hyphens from file names?  (Read 11284 times)

Ripper

  • Junior Woodchuck
  • **
  • Posts: 52
Batch removal of hyphens from file names?
« on: September 19, 2015, 09:35:49 pm »

Will MC20 batch-remove hyphens from all FLAC file names?  I have around 65,000 tracks on an NAS.  Bluesound can't play a file that has a hyphen in its name.  I just want to remove the hyphens from any tracks that contain them, but I don't want to manually search for file names with hyphens.  Would appreciate any help. Thanks.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Batch removal of hyphens from file names?
« Reply #1 on: September 19, 2015, 09:56:06 pm »

You could use MC's Find and Replace.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch removal of hyphens from file names?
« Reply #2 on: September 19, 2015, 11:23:47 pm »

There are several ways you could approach this.  One way is to use the Rename, Move, and Copy tool to standardize your file naming.  You'd select everything and then set up a template for the file names that didn't contain any "-" characters.  This would potentially rename every file you have, which might be a good thing, or might be a bad thing depending on what you want.  Having standardized names can be great as long as you have meta data to drive the process.  It makes everything very neat and clean.

But I have a funny feeling that's not going to appeal to you just yet.  So how about just removing those damned hyphens then?  Here's what I just tried and it seems to work:

1.  Go to a view that shows all of your files.
2.  In the search box at the top, paste in this:
Code: [Select]
[filename]=-This will find all files that have a hyphen anywhere in the name *or* the path name (folders).  If you don't want to find folders with hyphens and only care about the filename, use this instead:

Code: [Select]
[filename (name)]=-3.  Now you should see a list of all files that have hyphens in their names.  Select some of them as a test group.
4.  <right click> Library Tools > Rename, Move, and Copy Files.
5.  In the RM&C dialog that comes up choose the following options:
A.  Top pulldown list:  Rename
B.  Move all files in folder:  <Checked if you are going to be changing folder names too.  Unchecked if you are only changing file names.>
C.  Directories:  Unchecked
D.  Filename:  Unchecked
E.  Find and Replace:  Checked
  Find What:-
  Replace with: <type a space here if you want to replace with space.  Type nothing to just delete the hyphens.>
6.  Look at the preview pane to the right and examine the old and new file names.  Make sure that they look like you want them to.  If they don't, adjust your find and replace until they do.
7.  Press OK to rename these files.  Repeat from step 3 above with a larger group, or even everything remaining if you are confident.

That should work for you.  Make sure to test with several groups before you do thousands of files.  Check the Preview Pane!  Good luck.

Brian.
Logged

Ripper

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Batch removal of hyphens from file names?
« Reply #3 on: September 21, 2015, 12:01:23 am »

Thank you very much for the step-by-step tutorial.  I really appreciate it.

I tried the renaming on a small group of files, and it seemed to work, so I then ran it on everything else where it detected a hyphen in a filename.  While it appears that MC20 shows the filenames without the hyphens, when I examine the actual files they still have the hyphens.  I wonder whether MC20 is somehow changing its library but not the files, which are on a NAS.

Any ideas?
 
I just checked, and the pathname for my library led to an old pathname, not the current one.  I tried to add (browse to) the correct pathname, but it says it is in read-only mode

Thanks again for all your help.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch removal of hyphens from file names?
« Reply #4 on: September 21, 2015, 07:38:50 am »

I tried the renaming on a small group of files, and it seemed to work, so I then ran it on everything else where it detected a hyphen in a filename.  While it appears that MC20 shows the filenames without the hyphens, when I examine the actual files they still have the hyphens.  I wonder whether MC20 is somehow changing its library but not the files, which are on a NAS.

You might want to restore a database backup of MC to start over again.  *IF* you're sure the files haven't been renamed.  The KEY point i the RM&C tool is the mode pulldown at the top of the tool.  It has a mode called "Rename", which definitely renames files.  But it also has an "update" mode, which only changes MC's library.  It sounds like maybe you used that mode.  If you pull up the tool (RM&C), it should default to the last mode it was used it.  Take a look at the mode at the top and see what it says.

Quote
I just checked, and the pathname for my library led to an old pathname, not the current one.  I tried to add (browse to) the correct pathname, but it says it is in read-only mode

I don't understand what you've said about read only.  Is the NAS in read only?  Something else?

You could *try* running RM&C again, but this time in Move mode.  I'm really not sure what will happen.  You would need to try it with one or two files to see.

Are you able to PLAY any of the files that were updated?  If not, it sounds like the database got updated, but not the filesystem.  In that case, I would definitely restore a database backup made BEFORE you started this.  Luckily MC makes automatic backups every couple of days.

Brian.
Logged

Ripper

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Batch removal of hyphens from file names?
« Reply #5 on: September 21, 2015, 10:42:16 pm »

When I run MC, whether from a wireless Mac or a wired Windows machine, the program says it will run in read-only mode, without saving any changes. I can't figure out how to run it in read-write mode.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch removal of hyphens from file names?
« Reply #6 on: September 22, 2015, 09:05:01 am »

^ Where is MC's Library database stored?  Not the Media.  The Database itself.  On Mac this defaults to <your user directory/Library/Application Support/JRiver/Media Center 21/Library .

I ask because you mentioned Mac *and* Windows.  Are you sharing the Library file structure between two machines maybe?

I've heard of a read only library once or twice, but I have never gotten to a root cause and fix for it.  My instinct is to back up the library, make a brand new library, and restore the library backup to the new library.  Making certain that the new library is on a read/write local disk (not on a NAS).

Seems we are on a different mission now, which is fine.  If you still want help with the hyphens, we can pick that back up whenever you want.

Brian.
Logged

Ripper

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Batch removal of hyphens from file names?
« Reply #7 on: September 22, 2015, 09:50:40 am »

I think each computer stores its own library locally.  I ended up getting a Mac application dedicated to renaming, and I had it remove all the hyphens.  So far, I have tried just one song, but it seems to have worked.

I appreciate your help.  I would like to figure out how to get MC20 (and I have preordered MC21) to work in read-write mode.

Thanks again.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Batch removal of hyphens from file names?
« Reply #8 on: September 22, 2015, 10:07:22 am »

Well, two pieces of good news then.  :)  You are taking care of your hyphens issue.  MC will reimport any file you rename.  I think only the import date will change.  Test to be sure it keeps things like your star ratings and things like that.

The other good news:  MC21 has been out for several weeks now!  If you have a license, go download the latest MC21 from the MC21 forum:

http://yabb.jriver.com/interact/index.php?board=45.0

You'll need to back up your MC20 library and restore it into MC21 to get your old media and settings transferred. 

Good luck!


Brian.
Logged
Pages: [1]   Go Up