View previous topic :: View next topic |
Author |
Message |
sidetrack
Joined: 19 Oct 2010 Posts: 3
|
Posted: Tue Oct 19, 2010 8:01 pm Post subject: Adding path information into filename |
|
|
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 |
|
|
sidetrack
Joined: 19 Oct 2010 Posts: 3
|
Posted: Tue Oct 19, 2010 9:07 pm Post subject: |
|
|
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 |
|
|
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Fri Oct 22, 2010 5:27 am Post subject: |
|
|
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 |
|
|
sidetrack
Joined: 19 Oct 2010 Posts: 3
|
Posted: Sat Oct 23, 2010 2:11 am Post subject: |
|
|
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 |
|
|
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Sat Oct 23, 2010 6:55 am Post subject: |
|
|
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 |
|
|
|