1 source file, multi files

Advanced Renamer forum
#1 : 08/02-18 13:57
plexforce
plexforce
Posts: 2
Hi all,

I have a question about renaming from 1 source file to multi files.

I have a CSV file with the original name and also a the needed file names.
Like:
sourcefile-01.jpg;123.jpg
sourcefile-01.jpg;456.jpg
sourcefile-01.jpg;789.jpg

Example.
I have one file named: sourcefile-01.jpg
I want that file into multi files:
123.jpg
456.jpg
789.jpg

Is there a way to do this?


08/02-18 13:57
#2 : 08/02-18 15:34
Brian Hanlon
Brian Hanlon
Posts: 29
Reply to #1:
That's a COPY job, not a RENAME! - But as you have that CSV file, it would be pretty simple to import that file into a spread-sheet, insert a column between the filename pair, and insert a column at the beginning. Then by typing into Row 1, the extra info need for a batch file, and replicating it down the sheet, you could generate the data needed to make the batch file to do the job. Copy ALL the Columns/Rows from the spread-sheet into a reasonable Programmer's Notepad equivalent (I use Metpad but there are many), replace all 'tabs' with 'nulls' then save as RAW TEXT - a '.txt' file. Rename that txt file, changing the extension to '.bat', OK the warnings from Explorer, then double-click the new .bat file - as long as that .bat file is in the same folder as your original sourcefile-01.jpg, then the whole series will be created.

Example - CSV is:
sourcefile-01.jpg;123.jpg
sourcefile-01.jpg;456.jpg
sourcefile-01.jpg;789.jpg

Import to spread-sheet, insert column before and after 'sourcefile-01.jpg':

| |sourcefile-01.jpg| |123.jpg
| |sourcefile-01.jpg| |456.jpg
| |sourcefile-01.jpg| |789.jpg

('| |' stands for empty column.)

Add to row 1 as follows:

COPY "|sourcefile-01.jpg|" "|123.jpg|"| ... The '|' marks columns.

Replicate Columns 1,2,5 as required by your list.
Copy/Paste into 'MetaPad' or such, and you'll get:

COPY " > sourcefile-01.jpg > " " > 123.jpg > "
COPY " > sourcefile-01.jpg > " " > 456.jpg > "
COPY " > sourcefile-01.jpg > " " > 789.jpg > "

Replace all 'tabs with 'nulls' to get a usable batch file:

COPY "sourcefile-01.jpg" "123.jpg"
COPY "sourcefile-01.jpg" "456.jpg"
COPY "sourcefile-01.jpg" "789.jpg"

And that will do the job. Sure, you could spend ages trying to work out a 'FOR ... tokens ... ' loop to read the csv file and do the same job, but I have found that the spread-sheet method is usually faster overall. - Easier to repeat with a different csv and/or basefile, too!

Hope this helps.

Brian.


08/02-18 15:34
#3 : 08/02-18 15:57
plexforce
plexforce
Posts: 2
Reply to #2:


thank you, this works very well!!!



08/02-18 15:57