In continuation with the previous blog post that deals with the folder and file rename options, here we discuss how to deal with renaming of folders/files that contain illegal characters.
As said earlier, folders and files residing in legacy systems will have having special characters that are invalid (disallowed) in SharePoint. DocKIT facilitates this renaming by providing folder and file naming rules while migrating into SharePoint.
Certain users might also need migration of different versions of a file with their version named with certain patterns. DocKIT also supports this file version history creation seamlessly.
If you’re renaming a bunch of files in the same folder and those files don’t need completely different names from one another, Windows provides an easier way to rename those files in batch. Start by selecting a bunch of files—you can hold down the Ctrl key to select multiple files at once, or Shift to select a range of files.
- This would allow your answer to work for any input of the same pattern (garbage + s01e01 + garbage.mp4) – Mitch Apr 28 '16 at 19:08 @Musher FIle renaming should not be based on any assumption.also your regex could be simplified to just w.also + is Greedy. – heemayl Apr 28 '16 at 19:12.
- Rename file pattern windows batch. Ask Question Asked 6 years, 7 months ago. Active 6 years, 7 months ago. Viewed 6k times 6. I have some files looking like following. See SuperUser question How does the Windows RENAME command interpret wildcards? For unofficial documentation on wildcard rules. – dbenham Feb 28 '14 at 0:16.
Rename folders & files using naming rules
This option is intended /recommended for renaming folders & files that have characters not accepted in SharePoint as part of their names.
Windows Rename Files By Patterns
SharePoint disallows certain invalid characters in the folder and file names. In order to overcome this behavior, you need to replace certain characters that appear in Windows folder & file names and are invalid folder / file characters in SharePoint libraries, with valid characters (all characters except ~ # % & { } * | : < > / ?) in SharePoint. Adium all in one messenger for mac macos nmac ked.
For this, you can use the “Folder & File Renaming Rules” feature in DocKIT. This feature in DocKIT uses ‘Regular Expressions’ technique that is widely used in software applications where character pattern matching is crucial.
Consider the following cases:
Example 1: Order of entries when constructing renaming rules
The Folder and File Renaming rule in DocKIT requires the rule entries to be correctly placed for successful and meaningful replacement of invalid characters. The order of the entries (sequence) is important depending on the name of the files and folders. For example, if you want dot and double underscore OR triple dots to be treated as a single entity, then a rule entry with this value has to be given first. After this, you should provide dot and single underscore OR double dots value as entry.
Example:
Invalid File Name | Valid File Name | Description of the Renaming requirement |
Sa…ple File 1.doc | Sample File 1,doc | Replace 3 dots with ‘m’ |
Sam.le File2.doc | Sample File2.doc | Replace 2 dots with ‘p’ |
_ample File3.doc | Sample File3.doc | Replace_ with ‘S’ |
.Feb Report.xlsx | Feb Reprt.xlsx | Remove dot if the file name starts with . (dot) |
Jan Report.xls | Jan Report.xls | Remove dot if the file name ends with . (dot)Replace two consecutive dots with one |
._March Report.pdf | March Report.pdf | Replace ._ with empty |
.__ April Report.txt | April Report.txt | Replace .__ ( dot, two underscores) with empty |
__ May Report.pptx | May Report.pptx | Replace __ (two consecutive underscores) with empty |
._. June Report.ppt | justify;line-height:normal;mso-yfti-cnfc:128″>June Report.ppt | Replace ._. (dot, underscore, dot) with empty |
Windows Rename Files
Equivalent Naming Rules:
Find | Replace | Description |
… | m | Replace 3 dots with ‘m’ |
. | p | Replace 2 dots with ‘p’ |
.* | Remove dot if the file name starts with . (dot) | |
*. | Remove dot if the file name ends with . (dot) | |
.__ | Replace .__ ( dot, two underscores) with empty | |
._. | Replace ._. (dot, underscore, dot) with empty | |
._ | Replace ._ with empty | |
__ | Replace __ (two consecutive underscores) with empty | |
_ | S | Replace _ with ‘S’ |
Figure 1: Naming rule as specified in DocKIT application
Example 2: Usage of reserved characters
The ‘Regular Expressions’ technique used by DocKIT for pattern matching categorizes some of the operators as reserved and has its own meaning for the operators in the pattern syntax. In order to treat the reserved characters as normal characters like ‘A’, ‘1’, you have to use ” (backslash) as an escape sequence character in DocKIT Renaming rule as given below:
Invalid file name | Valid file name | Description | Naming rule | |
Find | Replace | |||
My File name#.xls | My File name.xls | Replace # with empty | # | |
Programs & Schedules.docx | Programs and Schedules.docx | Replace & with ‘and’ | & | and |
My $ File name.docx | My File name.docx | Replace $ with empty | $ | |
policydoc *74565.xls | policydoc 74565.xls | Replace * with empty | * | |
Sample.Doc | SampleDoc | Replace . with empty | . | |
Sample?File | SampleTextFile | Replace ? with ‘Text’ | ? | Text |
Test^Document | Testdocument | Replace ^ with empty | ^ | |
Sample+File | SampleTextFile | Replace plus with ‘Text’ | + | Text |
Word<Document | WordDocument | Replace < with empty | < | |
PDF>Document | PDFDocument | Replace > with empty | > | |
[Document | Document | Replace [ with empty | [ | |
Sample] | SampleFile | Replace ] with ‘File’ | ] | File |
(File | DocumentFile | Replace ( with ‘Document’ | ( | Document |
TextFile) | TextFile | Replace ) with empty | ) |
Create file version history by using certain naming patterns
We will discuss a situation where certain files in a folder have their names appended with version numbers. If you would like these version numbers to stack up nicely as version history of the file / document, this is what you can do.
Example 1: Uniform file naming pattern for file version
Invalid File Name | Valid File Name | Description | Naming Rule | |
Find | Replace | |||
My File name_v1.0.docx | My File name.docx | Replace underscore, v and version number appended with the parent file name with empty so as to create as respective versions of a file First version | *_v??.?? | |
My File name_v1.1.docx | My File name.docx | Next minor version | ||
My File name_v1.2.docx | My File name.docx | Next minor version |
Example 2: Random file naming pattern for file version:
Invalid File Name | Valid File Name | Description | Naming Rule | |
Find | Replace | |||
My doc_v1.0.doc | My doc.doc | Replace underscore, v and version number appended with the parent file name with empty so as to create as respective versions of a file First version | *_v* *v??.?? | v |
My docv1.1.doc | My doc.doc | Next minor version | ||
My docv1.2.doc | My doc.doc | Next minor version |
Note: Entries under the Find section should be in the same order as listed.
Figure 2: File Settings in DocKIT Task Wizard
To create version history, select ‘Create new version’ option in ‘File Settings’ step in DocKIT Task Wizard.
For more information, please refer the following help sections in the Dockit online help document. You can launch the help document from Help menu (Help -> Contents menu) in the application.
Windows 10 Rename Files Pattern
- DocKIT Features -> Folder & File Renaming Rules
- DocKIT Special Cases -> Rename Documents in File System