|Back to Script Page | Main|
|Tutorial:||How to revert an erroneous renaming action|
The Grep Rename script provides a very powerful means to rename any number of files.
On the downside, only one character missing from your search or replacement string
might be sufficient to completely screw up hundreds of files!
If you haven't disabled the log feature (and haven't further renamed any of the files in
question) its possible to revert any erroneous renaming action by help of the information
stored in the log.
The log keeps the following information about each renaming action:
Sonntag, 09. Dezember 2001 15:37:39 Uhr --------------------------------------- Search pattern: File(\d+) Replace pattern: TestFile_\1 ◊ Err: Old: File1 Macintosh HD:Desktop Folder:File1 New: TestFile_1 Macintosh HD:Desktop Folder:TestFile_1 ◊ Err: Old: File2 Macintosh HD:Desktop Folder:File2 New: TestFile_2 Macintosh HD:Desktop Folder:TestFile_2 ◊ Err: Old: File3 Macintosh HD:Desktop Folder:File3 New: TestFile_3 Macintosh HD:Desktop Folder:TestFile_3 • Err: File wasn't renamed but labeled with label index #6 since new file name already exists! Old: File4 Macintosh HD:Desktop Folder:File4 New: TestFile_4 Macintosh HD:Desktop Folder:TestFile_4 ∑ Files processed: 20 ∑ Files renamed: 3 ∑ Errors: 1
(Note: depending on your system language the date format might vary)
Now, to undo a particular renaming action, we simply need to extract the relevant old and new
paths, select them and execute the Rename Files of Path List script -- first upon the new paths,
then one more time on the old paths. Voila, that's it!
If you've got BBEdit, you can perform the steps below in order to achieve this: