#1 2009-08-20 17:33

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Meta tag :File_FilePath:

Announcement: since Beta from 20. Aug. 2009, ReNamer introduce an new meta tag :File_FilePath:

Many thanks to Denis.


( Note: :File_FilePath: will insert full path including the file name, so you have the file name twice.
            If you want the whole path incl. the file name, instead of the file name only,
            just use the desired rule REPLACE, see Example 3 below)

( Note2: Path is inserted with "\"-signs. Use as next an replace-rule to change this "\" to what you like, f.ex. to "_"
             or modify folder names to move the files to an new path. See Example 4 till 6 below)

-----------------------------------------------------------------------------------------------


An example
- start ReNamer
- Add file, f.ex. C:\Program Files\ReNamer\Translits\Russian (Latin).txt
- Add Rule > Insert > InsertMetaTag > :File_FilePath:
Result:
Name                       New Name
Russian (Latin).txt    C:\Program Files\ReNamer\Translits\Russian (Latin).txtRussian (Latin).txt
@Denis: maybe :File_FilePath: shouldn't include the file name itself?


Example 2:
- start ReNamer
- Add file, f.ex. C:\Program Files\ReNamer\Translits\Russian (Latin).txt

Step 1:
- Add Rule > Delete from Pos. 1 till the end, don't skip extension  (get rid of the whole file name to not have it twice)

Step 2:
- Add Rule > Insert > InsertMetaTag > :File_FilePath:
Result:
Name                       New Name
Russian (Latin).txt    C:\Program Files\ReNamer\Translits\Russian (Latin).txt

Step 3:
- Add Rule > Replace >  Find:   ":|\"    Replace:  "|_"
( Explanation: we find ":" and replace with nothing, also we find "\" and replace with "_" )
( Note: "*|*"  is an separator  to find more then one, like here we find ":" AND "\" )
( Note 2: since 22. Aug. 2009  separator sign "*|*"   is changed to  single "|" pipe sign only)
Result:
Name                       New Name
Russian (Latin).txt         C_Program Files_ReNamer_Translits_Russian (Latin).txt

Step 4:
- Add Rule > Rearrange > Split by delimiter "_"     New Order:  $3 - $4
Result:
Name                       New Name
Russian (Latin).txt        ReNamer - Translits.txt


-----------------------------------------------------------------------------------------------


Example 3:
Name                       New Name
Dancing Queen.mp3   

- Add Rule > Replace
      Find: "*"
      Replace: ":File_FilePath:"
      [X] Interpret "*" as wildcard     
      [ ] Skip extension
     (Note: "*" means "any number of characters (including numbers, space, underscores, etc.)."   
     Read more about this feature in the ReNamer wiki...)

Name                       New Name
Dancing Queen.mp3        X:\Multimedia\3\ABBA\Best of\Dancing Queen.mp3

- Add Rule > Rearrange > Split by delimiter "\"     New Order:  $4 - $6
Name                       New Name
Dancing Queen.mp3         ABBA - Dancing Queen.mp3

or
- Add Rule > Rearrange > Split by delimiter "\"     New Order:  $5 $4 - $6
Name                       New Name
Dancing Queen.mp3         Best of ABBA - Dancing Queen.mp3

or even
- Add Rule > Rearrange > Split by delimiter "\"     New Order:  $5 $4 - $6 (August 1976)
[X] Skip extension
Name                       New Name
Dancing Queen.mp3         Best of ABBA - Dancing Queen (August 1976).mp3

or more even
- Add Rule > Rearrange > Split by delimiter "\"     New Order:  $5 $4 - Duration 3'50, $6 (August 1976)
[X] Skip extension
Name                       New Name
Dancing Queen.mp3         Best of ABBA - Duration 3'50, Dancing Queen (August 1976).mp3


-----------------------------------------------------------------------------------------------


Example 4:
Name                       New Name
Import DLL functions.pas   

- Add Rule > Delete > from Pos. 1 till the end, don't skip extension
- Add Rule > Insert > InsertMetaTag > :File_FilePath:
Name                            New Name
Import DLL functions.pas      C:\Program Files\ReNamer\Scripts\Import DLL functions.pas

- Add Rule > Replace >  Find:   "scripts"    Replace:  "Script-Backup"
Name                         New Name
Import DLL functions.pas      C:\Program Files\ReNamer\scripts-backup\Import DLL functions.pas

- Rename:
The file  "Import DLL functions.pas"  is moved to "scripts-backup"  -folder
(To COPY the file instead you have to use PascalScript, search the forum...)


-----------------------------------------------------------------------------------------------


Example 5:
An other approach

Name                       New Name
Import DLL functions.pas   

- Add Rule > Replace
      Find: "*"
      Replace: ":File_FilePath:"
      [X] Interpret "*" as wildcard      (Read more about this feature in the ReNamer wiki...)
      [ ] Skip extension

Name                            New Name
Import DLL functions.pas      C:\Program Files\ReNamer\Scripts\Import DLL functions.pas

- Add Rule > Replace >  Find:   "C:|\"    Replace:  "(C)|-"
( Explanation: we find "C:" and replace with "(C)", also we find "\" and replace with "-" )
Name                       New Name
Import DLL functions.pas      (C)-Program Files-ReNamer-Scripts-Import DLL functions.pas


-----------------------------------------------------------------------------------------------


Example 6:
An another approach

Name                       New Name
Import DLL functions.pas   

- Add Rule > Rearrange
      Split using: ""
      New patterns: ":File_FilePath:"
      [ ] Skip extension

Name                            New Name
Import DLL functions.pas      C:\Program Files\ReNamer\Scripts\Import DLL functions.pas


- Add Rule > Replace >  Find:   ":|\"    Replace:  "|#"
( Explanation: we find ":" and replace with nothing, also we find "\" and replace with "#" )
Name                       New Name
Import DLL functions.pas      C#Program Files#ReNamer#Scripts#Import DLL functions.pas


-----------------------------------------------------------------------------------------------


Example 7:
Just an another approach

Name                       New Name
Import DLL functions.pas   

- Add Rule > RegEx                 (Learn more about RegEx at the ReNamer wiki)
      Expression: ".+"
      Replace: ":File_FilePath:"
      [ ] Skip extension

Name                            New Name
Import DLL functions.pas      C:\Program Files\ReNamer\Scripts\Import DLL functions.pas


- Add Rule > Replace >  Find:   ":|\"    Replace:  "#|_"
( Explanation: we find ":" and replace with "#", also we find "\" and replace with "_" )
Name                       New Name
Import DLL functions.pas      C#_Program Files_ReNamer_Scripts_Import DLL functions.pas


-----------------------------------------------------------------------------------------------
Learn more about this feature at the ReNamer wiki at http://www.den4b.com/wiki/ReNamer:Rules:Rearrange
-----------------------------------------------------------------------------------------------

Thank you Denis :D

Last edited by Stefan (2009-08-29 23:20)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#2 2009-08-20 17:43

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Meta tag :File_FilePath:

I like that one.
Thank you Stefan & Denis wink


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#3 2009-08-21 03:24

narayan
Senior Member
Registered: 2009-02-08
Posts: 470

Re: Meta tag :File_FilePath:

This is certainly too complex for newbies.

So I'd still prefer the ">n" and "<n" tokens.
That is far easier for new users to grasp and use.

To illustrate this, I have re-written your examples for Rearrange rule with <n tokens:

Just see how elegant it becomes!
And so simple that newbies can think of these solutions themselves.

Example-1:

Original file: C:\Program Files\ReNamer\Translits\Russian (Latin).txt
Desired new name: ReNamer - Translits.txt

Rearrange rule settings:
Split using: leave blank
New order: <2 - <1
Skip extension [x]


Example-2:

Original file: X:\Multimedia\3\ABBA\Best of\Dancing Queen.mp3
Desired new name: ABBA - Dancing Queen.mp3

Split using: leave blank
New order: <2 - $0
Skip extension [x]


Example-3:

Original file: C:\Program Files\ReNamer\Scripts\Import DLL functions.pas
Desired new name: C:\Program Files\ReNamer\Scripts-backup\Import DLL functions.pas

Split using: leave blank
New order: <0-backup\$0
Skip extension [x]

Note: Similar to the "$0" token, "<0" means the entire (current) path.

**************
BTW in your first example, the first two steps can be replaced by a single Rearrange rule.

Split using: leave blank
New order: :File_FilePath:
skip extension [ ]  (otherwise we get two extensions).

This step adds the whole path (with filename and extension) as the new name.
The extension needs to be removed.

Last edited by narayan (2009-08-21 03:25)

Offline

Board footer

Powered by FluxBB