Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (***NEW HOME PAGE*** "http://pfrank.atwebpages.com")
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is there a way to: Rename, move to folder, increment & l

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support
View previous topic :: View next topic  
Author Message
goodguyndfw



Joined: 01 Dec 2008
Posts: 6

PostPosted: Tue Dec 02, 2008 12:56 am    Post subject: Is there a way to: Rename, move to folder, increment & l Reply with quote

I have 500 unique squencial numeric ID names and 433 unique numeric static photo names in this project. EACH ID name should have the 433 photos assigned to it as part of a new file name. Example:

INITIAL
Filename(s) = 100.jpg, 110.jpg, 120.jpg....etc

RESULTS
Loop:
thumb_33300_100_1.jpg
thumb_33300_110_1jpg
thumb_33300_120_1.jpg
(433x then)
thumb_33301_100_1.jpg
thumb_33301_110_1.jpg
thumb_33301_120_1.jpg
(433 then increment by one)

I understand how to increment and even build the folders I think, but not sure how to increment the userID number by one, build a new folder with that name and then start the process again.

Actually, it doesn't matter if the filename results all build in the same directory or if a subdir is created for each new incremental change.

I appreciate the tool. Very powerful and I will recommend it, certainly. If anyone has any ideas on creating a macro/script/magic that does as described above, please share. As of now, I'm a manually changing the userID and then renaming, moving the results to another folder via file Explorer then repeating the steps. Doing it 500 times will suck.

Thank you.
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Tue Dec 02, 2008 5:37 am    Post subject: Reply with quote

Hi,

I think I need more precise information about the original and final names but I'll make some assumptions and provide at least a partial solution.

I'll assume that the new/old names (without the extension) are something like the following:

oldname newname
====== =======
100_1 thumb_33300_110_1
110_1 thumb_33300_120_1
120_1 thumb_33300_130_1
...
4330_1 thumb_33300_4330_1


100_2 thumb_33300_110_2
110_2 thumb_33300_120_2
120_2 thumb_33300_130_2
...
4330_2 thumb_33300_4330_2



100_3 thumb_33300_110_3
110_3 thumb_33300_120_3
120_3 thumb_33300_130_3
...
4330_3 thumb_33300_4330_3


...



100_500 thumb_33300_110_500
110_500 thumb_33300_120_500
120_500 thumb_33300_130_500
...
4330_500 thumb_33300_4330_500



If that is true, then the following series will do most of the work required:

Row: 1
Search: '(.*?)_([0-9]+)'
Replace: 'thumb_33_\2_\1_\2'
Row: 2
Search: '(?x)thumb_33([^0-9]|^)([0-9])([^0-9]) # pad for 1 digit'
Replace: 'thumb_33\g<1>00\2\3'
Row: 3
Search: '(?x)thumb_33([^0-9]|^)([0-9]{2,2})([^0-9]|$) # pad for 2 digits'
Replace: 'thumb_33\g<1>0\2\3'
Row: 4
Search: '(?x)^(.*?)(_33)_ # merge 2 numbers'
Replace: '\1\2'


Paste the information between the single quotes into the specified rows (or copy all the above info with the mouse, select the main window of PFrank, press ctl-f2 -> then the info will be automatically pasted to the top rows in one swoop).

Then drag a sample filename into the sample previewer (or paste it instead) and see the name change from something like:


110_1.jpg to thumb_33000_120_1.jpg

You can play with enabling/disabling each row to see how the name changes.

This result is almost what you want. In the example you gave the final result ends in 33500_120_1.jpg

There is already a plugin that adds an offset to numbers within a name. In this case you would want to add 500 to the 33000. That plugin is easily adaptable to perform this action.

The sequence above can be modified to also move the groups of 433 files into their own subfolders. ALso, the first sequence you gave didn't have a trailing number but that can be taken care of as well.

I don't want to go any further until I have more complete info on the oldname/newname mappings.

Hope this helps.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
goodguyndfw



Joined: 01 Dec 2008
Posts: 6

PostPosted: Tue Dec 02, 2008 1:53 pm    Post subject: Wow, thanks for the suggestions Reply with quote

I tried to play with it a little but I suppose my brain is a bit slow for some reason. Ha. Your suggestion is close but my explaination was not clear enough.

The actual photos are named in increments of 10 starting at 100.jpg about 450 of them. So 100.jpg, 110.jpg, 120.jpg and so on.

I have about 500 profiles in a database that each needs all of those photos assigned to each one. So the database can relate the pictures to a particular picture, it needs to have a unique photo file name in a specific format:

Current:
100.jpg

New:
thumb_[X]_100_1.jpg

Where X = the profile ID number (ie. 33658 or 33659 or 33660...)

Final would look like

thumb_33658_100_1.jpg
thumb_33658_110_1.jpg
thumb_33658_120_1.jpg

and so on until the last photo which I believe is 4490.jpg then repeat for new user ID:

thumb_33659_100_1.jpg
thumb_33659_110_1.jpg
thumb_33660_120_1.jpg

and so on.

The application explodes the photo file name to determine what to do with it. 'thumb' defines placement, '33659' defines the record it is associatd with, '100' defines the photo itself and the '1' means it is the primary picture for that record. Perhaps too much of an explaination. hahah.

I am sincere in my thanks for helping me on this. I am up against, actually past, a deadline for the project. Yikes.

Greg
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Tue Dec 02, 2008 5:01 pm    Post subject: Reply with quote

This is more than renaming.
If I understand you correctly you have 433 files and you want to create 500x433 files where all the new filenames are based on 500 entries in a database.

Since you are creating files as well as renaming, the only way to do that is with a plugin.

The algorithm would be something like:

For each file passed to the plugin:
open the database file (assume each db profile entry is on one line)
for each line X in the database:
copy the file to one named:
'thumb_' + X + '_' + originalfilenameprefix + '_1' + '.jpg'

Does the new file always end with '_1'? If not, is the '1' also coming from the database?
The copying and renaming would take place in the plugin. There wouldn't be a preview available

It's not that difficult depending on what the database file looks like (a txt file with a profile on each line would be simplest).

If you have any programming experience it should be fairly straight forward especially if you already know Python.

Sorry about you deadline as I can't help you there; I have to leave for my own job right now.
No promises but I could look at it tonight if you send me a sample database file.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
goodguyndfw



Joined: 01 Dec 2008
Posts: 6

PostPosted: Mon Jan 26, 2009 5:14 pm    Post subject: I'm back LOL - help? Better background information Reply with quote

I have a request for help you and your loyal followers may be interested in how it works Smile I know there is a lot of words in this post but perhaps the actual instruction set in PFrank is realitively easy. Just wanted you to understand the scenario in play.

I promise I'm not completely dumb but I just can't get this thing to work. I tried a different approach on changing how I store images on the server side but it won't work and now back to hopefully using your tool to make the files work with the application's file folder and picture naming conventions.

Here's what I have and what I need:

When the application I have builds a customer's profile (think myspace or facebook) it creates a unique file folder structure for each profile using the unique profile id number it created. i.e. -

/media/profiles/110628

then it creates a unique pic id and stores 3 files in there based on that main picture id used for the profile. i.e. -

/media/profiles/110628/icon_110628.jpg (40w x 45h pxl)
/media/profiles/110628/thumb_110628.jpg (98w x 110h pxl)
/media/profiles/110628/photo_110628.jpg (305w x 340h pxl)

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

I have 250k profiles to insert into this application so you can see doing it manually via the application is not practicle. So I actually used a spreadsheet (named aprofilexls2.xls) to mimic all the profile fields with my specific data so I can upload them to the application database direct. I also used a macro to convert/generate a picture of each 'name' text field which will be used as the photo icons in the profile. "BOB" in field A2 of my spreadsheet is now a picture file named aprofilexls2(2).tif on my hard drive -

/ExcelOutput/aprofilexls2(1).tif
/ExcelOutput/aprofilexls2(2).tif
/ExcelOutput/aprofilexls2(3).tif

and so forth up to 65k rows since that's all Excel XP will allow. I have 4 spreadsheets I will load to the server db once I get the picture file structure in place.

On one hand it seems simple but each time I try it using PFrank, I get all nervous or something and can't make it work. Haha. Just kidding but you would really save me if you could show me an efficient way to get this -

From
/ExcelOutput/aprofilexls2(2).tif

To
/media/profiles/110628/icon_110628.jpg (40w x 45h pxl)
/media/profiles/110628/thumb_110628.jpg (98w x 110h pxl)
/media/profiles/110628/photo_110628.jpg (305w x 340h pxl)



The unique profile id's are sequential so the next profile is 110629 in the above example, then 110630 and so forth for 250k of them total (again split into 4 different spreadsheets called aprofilexls.xls, aprofilexls2.xls, aprofilexls3.xls and aprofilexls4.xls. The first unique profile ID is 90000.

Once I have the file structure down, I can ftp everything up to the server then import my spreadsheets into the database tables.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own Video Sharing Site

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com