![]() |
#1
|
|||
|
|||
![]()
My file contains file path and document name info from our work folder and subfolders.
Using search and replace how would I delete the file path info, that is, the "K:\" and everything else up to and including the last "\" in each paragraph (leaving only the file name info). Is there a way to do this? Carol |
#2
|
||||
|
||||
![]()
Hi Carol,
A simple Find/Replace should be able to handle that - simply input the complete path as the Find expression and leave the Replace expression empty.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Macropod
That would work for half of the file path, our directory structure contains many folders and subfolders. I have several pages to clean up on a monthly basis -- was just thinking there would be a way to find and delete from the start of the line to the last backward slash in the line. Perhaps not. Thanks anyway. Carol |
#4
|
||||
|
||||
![]()
Given that the folder paths are different, you could try a wildcard Find/Replace, where:
Find = (*)([A-Za-z0-9 ._\-\(\)\[\]\{\}]{1,}^13) Replace = \2 There may be some other valid filename characters that the Find expression doesn't cover, but you can add them easily enough.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Macropod
Thank you for your help. This search and replace worked on some lines and not others (maybe because my file names contained hyphens, don't know). But anyway I should have requested that this thread be closed because I found a solution in the Excel forum in an existing post titled word up to last "\" Carol |
#6
|
||||
|
||||
![]()
Hi Carol,
The Find/Replace expression caters for hyphens, so it's probably some other character that I hadn't catered for.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Okay, I see. turns out there were lots of them: open & close parenthesis, apostrophy, ampersand. Probably better to use the Excel solution. Since I have no control over what folks are naming the files.
|
#8
|
||||
|
||||
![]()
Parentheses, braces & square brackets are all catered for, but ampersands were not. As I said in the post, you could easily add additional characters to the Find expression if you need them (in this case \&)
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
Alright I added a few more, the plus sign and comma. I will keep this in my personal folder for future use. It will be easier than copying and pasting to Excel. Thank you.
|
#10
|
||||
|
||||
![]()
If you're going to be doing a lot of this (and, from what you've posted, it seems likely), record the Find/Replace as a macro, which you can then call via Alt-F8 or even via a keyboard shortcut. It'll save a lot of time and be less error-prone than trying to replicate it each time.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
![]()
That's a good idea, will do.
|
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2010 & Redundant Files Cleanup | goombarok | Outlook | 0 | 03-09-2012 08:04 AM |
![]() |
rohitjain80 | Mail Merge | 1 | 02-12-2012 03:42 AM |
Cleanup Feature | mlocy | Outlook | 0 | 01-25-2012 09:06 AM |
Active Directory | ababc | Misc | 0 | 09-19-2006 06:18 AM |
Active Directory | nukkumatti | Misc | 0 | 11-16-2005 08:42 AM |