INTERACT FORUM

Please login or register.

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

Author Topic: HELP: Expression not translating to rename/move/copy files.  (Read 2028 times)

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854

So I have an library expression [album location] that I want to use for creating filepaths when renaming files.  The expression is:

if(isequal([genre],Jazz),My Music\My Jazz Music,My Music)

This should have the effect of specifying the root for albums as:

drive:\My Music\

or

drive:\My Music\My Jazz Music\

But when using the Rename, Move & Copy Files tool, and using [album location] as the directory rule, the \ is changed to a _ which breaks the directory structure I am attempting to create  :'(

I've tried escaping the backslash, but that hasn't helped.

Anybody??  ?

Thanks,

Mark


Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #1 on: June 17, 2011, 06:45:38 am »

Further to this I see that \ is not allowed in the Directories rule at all and yet it is allowed in the Filename rule...

Matt???

Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72439
  • Where did I put my teeth?
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #2 on: June 17, 2011, 06:48:40 am »

Try a double backslash.
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #3 on: June 17, 2011, 06:52:40 am »

Jim, tried everything, but no go...  definitely an MC "issue"
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #4 on: June 17, 2011, 11:25:50 am »

I've verified this too.

The expression field in the library works fine, but it appears the Rename code, during field evaluation/expansion, changes potentially path-dangerous characters into underscores.  Adding additional escapes to the expression field in the library does not appear to provide a means for escaping this transliteration.
Logged
The opinions I express represent my own folly.

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #5 on: June 17, 2011, 12:06:49 pm »

Update - it's not allowed in the filename rule as part of an expression.

This needs to be "fixed" so that we can create directories using expression...  please  ;D
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #6 on: June 17, 2011, 12:17:42 pm »

Update - it's not allowed in the filename rule as part of an expression.

This needs to be "fixed" so that we can create directories using expression...  please  ;D

It would be worth being clearer about this.  The Rename dialog *does* allow expressions.

The problem you are describing here occurs when a Library Field contains a desired *path* component, and that Field is then subsequently used in the Rename dialog to construct a directory or file name.  MC is protecting from, say, a ":" character being introduced into the new path name, which would fail as ":" is not allowed within a file or directory name.  It is managing all path-dangerous characters, which also includes "\".  Otherwise, how would MC differentiate between, say "AC\DC" and "\some\path"?
Logged
The opinions I express represent my own folly.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #7 on: June 17, 2011, 12:43:00 pm »

MrC is correct in his statement above, so, try introducing a "replace()" function when using the rename tool.

replace([album location],_,\)

-marko

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #8 on: June 17, 2011, 12:43:46 pm »

Well it would of course be correctly tagged AC/DC, which wouldn't then be a problem :P

I get your point however, but in my library of 6000+ artists there are none with a \ in their name.  Doesn't mean they don't exist of course...

The Rename dialogue has a separate Directories and Filename section.  Perhaps only the directories section would allow the use of \ in expressions to create directories, which would help avoid the (non-IMO)problem?



Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #9 on: June 17, 2011, 12:45:20 pm »

MrC is correct in his statement above, so, try introducing a "replace()" function when using the rename tool.

replace([album location],_,\)

-marko

Well, that's a solution I can work with.

As always, thanks Marko!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: HELP: Expression not translating to rename/move/copy files.
« Reply #10 on: June 17, 2011, 01:06:06 pm »

Well it would of course be correctly tagged AC/DC, which wouldn't then be a problem :P

I get your point however, but in my library of 6000+ artists there are none with a \ in their name.  Doesn't mean they don't exist of course...

Right, I know.  But I didn't feel like looking for a pedantically correct example.

Still, the problem with "AC/DC" remains when the file system is *nix-based NAS.  The "/" will need to be replaced because MC doesn't know what the underlying FS allows.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up