#1 2022-08-29 06:59

jv007
Member
Registered: 2022-08-29
Posts: 6

Using rules AND Import new names from a CSV file

Hi there,

I am new to the reNamer application and I can see some potential great uses for this. Wonderful tool to start with.

I had a question if I may which combines using rules and a already prepared .CSV file. I have scoured the forum to see if this has been answered but couldn't find anything.


I have PDFs that look something like this. 025186000101012.pdf. Renamer works well in helping me turn this into 02518-6.pdf

I would love to go one step further and change these into a lookup onto a CSV file. Hopefully you can see in the screenshot that it's a lookup that will translate the 02518-6 into a name.

Any suggestions on how to do this?

From 025186000101012.pdf -> 02518-6.pdf -> ABCDEFGH.pdf (just an eg)

Many thanks
JV    smile

Last edited by jv007 (2022-08-29 06:59)

Offline

#2 2022-08-29 07:00

jv007
Member
Registered: 2022-08-29
Posts: 6

Re: Using rules AND Import new names from a CSV file

mini_reNamer---CSV-input-YcMX.png







jv007 wrote:

Hi there,

I am new to the reNamer application and I can see some potential great uses for this. Wonderful tool to start with.

I had a question if I may which combines using rules and a already prepared .CSV file. I have scoured the forum to see if this has been answered but couldn't find anything.


I have PDFs that look something like this. 025186000101012.pdf. Renamer works well in helping me turn this into 02518-6.pdf

I would love to go one step further and change these into a lookup onto a CSV file. Hopefully you can see in the screenshot that it's a lookup that will translate the 02518-6 into a name.

Any suggestions on how to do this?

From 025186000101012.pdf -> 02518-6.pdf -> ABCDEFGH.pdf (just an eg)

Many thanks
JV    smile

Offline

#3 2022-08-29 13:33

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

Re: Using rules AND Import new names from a CSV file

Hi and welcome JV

You mean smtg like

"Index» ReNamer» Rename multiple files using a txt file?"
https://www.den4b.com/forum/viewtopic.php?id=2867

Index» ReNamer» From CSV to file name; best way?
https://www.den4b.com/forum/viewtopic.php?id=2846



If more questions, just ask . . .
 


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

#4 2022-08-30 02:00

jv007
Member
Registered: 2022-08-29
Posts: 6

Re: Using rules AND Import new names from a CSV file

Thanks Stefan for your prompt response and warm welcome smile, it is something similar to the method I was thinking was using is the import file path and new names.

I have experimented use .csv and .txt, I believe I might be doing something wrong. Your links are quite helpful, am i missing something like the file path? As you can see from the screenshot, importing does show some information. However, when i drag a pdf into the area, I'm not sure how the rules 1 and 2 then work with the import .csv file.

Thanks!


mini_renamer2.png

Last edited by jv007 (2022-08-30 02:05)

Offline

#5 2022-08-30 15:59

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

Re: Using rules AND Import new names from a CSV file

Hi jv007,

how are your steps?
1) add Insert-rule
2) add Delete-rule
3) utilize "Import file paths and new names"

I am not sure yet if that works together.


Can you try it this way?
1) utilize "Import file paths and new names"
2) add Insert-rule at the new names
3) add Delete-rule at the new names


If I find some time I will try it myself too.
Can you provide some examples (up to five) as plain text, not as screenshot.
Current names:
x
y
Wanted names:
a
b
Related lines from the fatos.txt:
x a
y b


- - -


I have collected here the information about "Import file paths and new names" for further references:

See https://www.den4b.com/wiki/ReNamer:Export_menu
Import file paths and new names    >> Imports file paths and new names from the .csv (comma separated) or .txt (tab separated) file.

The "Import file paths and new names" option requires two columns in the import file: FULL path (before 7.3.0.3 Beta) and new name.

.csv (comma separated)
D:\rive\Full Path to\My old name.ext,Wanted New Name.ext

.txt (tab separated)
D:\rive\Full Path to\My old name.ext  <tab key>   Wanted New Name.ext


Have no header as first line, start with the first file pair at the first line.
Have no other rules activated!

Save it to a file with a *.csv or *.txt extension, place it into the same folder as your source files,
and then use the Import file paths and new names option from the Export menu.

Inspect the Path column after you import the CSV file. Make sure that the paths for all files are correct, including the extension.
Else you may get "The system cannot find the file specified."



Currently, this importing function does NOT handle relative paths.
Note that you will need to use at least ReNamer 7.3.0.3 Beta in order
to handle relative source file paths (1st column) in the imported CSV file.

.csv (comma separated)
My old name.ext,Wanted New Name.ext

.txt (tab separated)
My old name.ext<one tab key>Wanted New Name.ext

Older versions will expect FULL source file paths.




.


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

#6 2022-08-31 02:13

jv007
Member
Registered: 2022-08-29
Posts: 6

Re: Using rules AND Import new names from a CSV file

Thanks so much Stefan for getting back to me and finding the time at your end to look into this as well. I will take at my end on your suggested method. Will circle back on this.

My ReNamer Lite is version 7.3 - 14/04/21

If I find some time I will try it myself too.
Can you provide some examples (up to five) as plain text, not as screenshot.
Current names:

v - 023248000101011.pdf
w - 025682000101011.pdf
x - 024228000101011.pdf
y - 016101000101011.pdf
z - 013439000101011.pdf

Wanted names:
a - ANIMA HOLDING S.A.pdf
b - CM HOSPITALAR S.A.pdf
c - CAMIL ALIMENTOS S.A.pdf
d - GAFISA S.A.pdf
e - METALURGICA RIOSULENSE S.A.pdf

Related lines from the fatos.txt:
v a
w b
x c
y d
z e

- My CSV file looks similar to this (Split into two columns)

textoPequeno    textoGrande
01610-1            GAFISA S.A.
01343-9            METALURGICA RIOSULENSE S.A.
02422-8            CAMIL ALIMENTOS S.A.
02568-2            CM HOSPITALAR S.A.
02324-8             ANIMA HOLDING S.A.


-*Updated* - .CSV zip file if interested
fatos.zip

Last edited by jv007 (2022-08-31 02:15)

Offline

#7 2022-08-31 06:41

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

Re: Using rules AND Import new names from a CSV file

I am confused.

Where is the relation ship between real name and your list?

-----------------------------------------------------------
Current names:
v - 023248000101011.pdf

Wanted names:
a - ANIMA HOLDING S.A.pdf

Related lines from the fatos.txt: (that looks different in your screenshot, more like a copy of the CSV)
v a

CSV
textoPequeno    textoGrande
02324-8             ANIMA HOLDING S.A.
-----------------------------------------------------------



- - -


You mean
"v - 023248000101011.pdf" and "02324-8             ANIMA HOLDING S.A."        are related just by the number?



So you don't have your list in same order as the file names?

We have to match a filename with "023248" to your list where we can find a line with "02324-8" ?


- - -


"Import file paths and new names" works if you have the real original filenames as first column in your CSV.
A 1:1 relationship.
Have a real filename like "Example.txt" and have "Example.txt" as first column and the wanted new name as second column.




For your issue you will need a script to take the fist 6 digits and find the right line from your CSV
"z - 013439000101011.pdf"   >> related to >>   "01343-9            METALURGICA RIOSULENSE S.A."

Then take the new name from the second column only  >>>> "z - METALURGICA RIOSULENSE S.A.pdf"

And also replace all leading "z" with an "e" >>>> "e - METALURGICA RIOSULENSE S.A.pdf"

Right?


I will re-read all again if I had miss something.
EDIT:
Ah, now I understand, you use the two rules to change the filename to a make it match to the one from the CSV.
And next import the new names from the CSV?
That will not work in one single step. Do a renaming first with the rules , next use the Import at an second renaming operation.
I will do a test how I would do it. . . . .


 


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

#8 2022-08-31 06:56

jv007
Member
Registered: 2022-08-29
Posts: 6

Re: Using rules AND Import new names from a CSV file

Ah, sorry Stefan, my apologies, i think I may have misread the headings in your original post. I was hoping I could the .csv file similar to a vlookup which onces the rules have been applied, the .csv file will help rename what's in that file.

Original file downloads look like below:

v - 023248000101011.pdf
w - 025682000101011.pdf
x - 024228000101011.pdf
y - 016101000101011.pdf
z - 013439000101011.pdf

Using Renamer, i have 2 rules that rename the above:
1) Rule Insert - Insert "-" at Position 6
2) Delete from Position 8 until the End.

Now that we have the invoices in the right format (eg. 02324-8.pdf) - Taking v has an example.

I was hoping that perhaps renamer can use the .CSV file as a lookup sheet to match the 02324-8.pdf to whats on their so in this example it would be  ANIMA HOLDING S.A.pdf. The PDFs when we drag it into Renamer maybe in any order.

Sorry, if I m not clear, hope I have explained it a clearer.

Thanks
JV

Offline

#9 2022-08-31 10:49

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

Re: Using rules AND Import new names from a CSV file

I have not enough time right now (on work), but I make a little test


If you can drop the leading chars, you could do this (else we have to write a PascalScript for you)


TESTs


STEP-1

FROM:
v - 023248000101011.pdf
w - 025682000101011.pdf
x - 024228000101011.pdf
y - 016101000101011.pdf
z - 013439000101011.pdf
TO:
01343-9.pdf
01610-1.pdf
02324-8.pdf
02422-8.pdf
02568-2.pdf
USE:
1) Delete: Delete from Position 1 until Count reaches 4 (skip extension)
2) Delete: Delete from Position 7 until the End (skip extension)
3) Insert: Insert "-" at Position 6 (skip extension)


Check the Preview.
Rename that.


STEP-2

Then adjust the CSV
- use NO headers
- add full path to first column (or try newest beta >=7.3.0.3)
- add extensions to old and new file names
- add NO tabs, but one comma only
D:\rive\Full Path to\My old name.ext,Wanted New Name.ext


If you would use TAB between old and new name, then use .txt (tab separated) file
D:\rive\Full Path to\My old name.ext<one tab key>Wanted New Name.ext


Disable all rules.
Use "Import file paths and new names"

Check the Preview.
Rename that.



. . . . still testing (only little time right now)
 


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

#10 2022-08-31 12:00

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,374

Re: Using rules AND Import new names from a CSV file

jv007 wrote:

From 025186000101012.pdf -> 02518-6.pdf -> ABCDEFGH.pdf

Step #1

Rename your files to match the intermediate name, i.e. the first column in the CSV file.

025186000101012.pdf -> 02518-6.pdf

I think you already know how to do this.

Step #2

Prepare your CSV file to have two columns with "From" and "To" filenames, including file extension. No header row.

Something like that:

02518-6.pdf,ANIMA HOLDING S.A..pdf

Place the CSV file in the same folder as PDF files.

Start a new project (Ctrl+N) in ReNamer, import the CSV file using the "Import file paths and new names" option, and then click the "Rename" button.

Note: You will need to use at least ReNamer 7.3.0.3 Beta in order to handle relative paths in the CSV file.

Offline

Board footer

Powered by FluxBB