Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

71%
+3 −0
Q&A How can I print both "before" and "after" filenames when batch-renaming files?

I'm trying to bulk-rename files in a directory and its subdirectories. I want to print each file's name before and after renaming, ideally on the same line in the form: original_filename -> new...

1 answer  ·  posted 1y ago by ShadowsRanger‭  ·  last activity 1y ago by ShadowsRanger‭

Question arch-linux renaming
#3: Post edited by user avatar ShadowsRanger‭ · 2025-07-20T10:21:53Z (about 1 year ago)
  • How can I print both "before" and "after" filenames when batch-renaming with find and perl-rename?
  • How can I print both "before" and "after" filenames when batch-renaming files?
#2: Post edited by user avatar ShadowsRanger‭ · 2025-07-20T09:49:07Z (about 1 year ago)
  • I'm trying to bulk-rename files in a directory and its subdirectories using `find` and `perl-rename`. I want to print each file's name before and after renaming, ideally on the same line in the form:
  • ```
  • original_filename -> new_filename
  • ```
  • Right now, my command is:
  • ```
  • find . -type f -print -exec perl-rename -n 'regex' {} +
  • ```
  • But this only prints the filenames before they are renamed, not after. I want to see what the new name will be for each file, so I can review changes before running for real.
  • How can I print both before and after filenames (e.g. `before -> after`) when running a batch rename like this?
  • I'm trying to bulk-rename files in a directory and its subdirectories. I want to print each file's name before and after renaming, ideally on the same line in the form:
  • ```
  • original_filename -> new_filename
  • ```
  • Right now, my command is:
  • ```
  • find . -type f -print -exec perl-rename -n 'regex' {} +
  • ```
  • But this only prints the filenames before they are renamed, not after. I want to see what the new name will be for each file, so I can review changes before running for real.
  • How can I print both before and after filenames (e.g. `before -> after`) when batch renaming files?
#1: Initial revision by user avatar ShadowsRanger‭ · 2025-07-20T09:46:37Z (about 1 year ago)
How can I print both "before" and "after" filenames when batch-renaming with find and perl-rename?
I'm trying to bulk-rename files in a directory and its subdirectories using `find` and `perl-rename`. I want to print each file's name before and after renaming, ideally on the same line in the form:

```
original_filename -> new_filename
```

Right now, my command is:

```
find . -type f -print -exec perl-rename -n 'regex' {} +
```

But this only prints the filenames before they are renamed, not after. I want to see what the new name will be for each file, so I can review changes before running for real.

How can I print both before and after filenames (e.g. `before -> after`) when running a batch rename like this?