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 

Adding path information into filename

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions
View previous topic :: View next topic  
Author Message
sidetrack



Joined: 19 Oct 2010
Posts: 3

PostPosted: Tue Oct 19, 2010 8:01 pm    Post subject: Adding path information into filename Reply with quote

I have a bunch of files which should look like this:

folder1/folder2/folder3/folder3 - file.ext

A fair number don't begin with the folder information on the beginning of the file. I know that looks like repetitive information but it's just an intermediate step in getting things organized.

My question is how can I get hold of the path information (folder3) so i can use it in renaming the file? I'm just reacquainting myself with regex, so I may be missing something very obvious.
Back to top
View user's profile Send private message
sidetrack



Joined: 19 Oct 2010
Posts: 3

PostPosted: Tue Oct 19, 2010 9:07 pm    Post subject: Reply with quote

OK, a little further research shows me there is a pre-defined command for this: Parent Folder Name Insertion

This post can probably be deleted from the Regular Expressions forum, or moved to a more appropriate forum.

I'm still having trouble excluding files that already have this information at the beginning of the filename
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Fri Oct 22, 2010 5:27 am    Post subject: Reply with quote

For the exclusion problem you are having you might need to use a plugin.

If you show some exact before/after examples, I'll be able to tell you with certainty whether you need a plugin or not.

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



Joined: 19 Oct 2010
Posts: 3

PostPosted: Sat Oct 23, 2010 2:11 am    Post subject: Reply with quote

Here are a few examples:

C:\Users\Default\Documents\Ebooks\Single\George Orwell\George Orwell - 1984.epub <-- Should Exclude

C:\Users\Default\Documents\Ebooks\Single\George Orwell\Animal Farm.epub <-- Before

C:\Users\Default\Documents\Ebooks\Single\George Orwell\George Orwell - Animal Farm.epub <-- After

C:\Users\Default\Documents\Ebooks\Single\George Orwell\G. Orwell - Burmese Days.epub <-- Before

C:\Users\Default\Documents\Ebooks\Single\George Orwell\George Orwell - Burmese Days.epub <-- After

Obviously with the last one would require some regex beyond the Parent Folder Name Insertion
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 448
Location: Canada

PostPosted: Sat Oct 23, 2010 6:55 am    Post subject: Reply with quote

You might not have to exclude anything if the following is true:

1)
If a filename has a dash character, then use row 1 search/replace to eliminate everything before the dash.
2)
Use row 2 search/replace to to insert the parent folder.

Use something like this for row 1 (don't copy the single quotes):

search:
'^.*?\-'
replace:
'-'

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> Regular Expressions 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