New answers tagged

3 votes
Accepted

shell one-liners for bulk-renaming multiple files

If you can install zsh: XX - title.flac to XX title.flac regular files. zsh <<\EOF autoload zmv zmv -n '(**/)(<-> )- (*.(#i)(ogg|mp3|flac))(#q.)' '$1$2$3' < /dev/tty EOF GENRE - ...
Stéphane Chazelas's user avatar
1 vote
Accepted

Rename file in Mac OS Terminal using Regex or translate from Windows Script

In zsh, from within the directory that contains those files, you'd run: autoload -Uz zmv zmv -n '*_ \((<0-999>)\)(* )—( * )(<1-12>)_(<1-31>)_(<1900-2100>)(.mp3)' \ '${(l[...
Stéphane Chazelas's user avatar
0 votes
Accepted

How to rename files to specific string in their filenames

With zsh: autoload -Uz zmv zmv -n '*\[*.(<->)\]\[*(.json)' '$1$2' Remove the -n (dry-run) if happy. The zmv autoloadable function takes two arguments: a zsh extended glob pattern a replacement ...
Stéphane Chazelas's user avatar
0 votes

How to rename a file into a random GUID?

On Linux: (ret=0 for file in *; do IFS= read -r uuid < /proc/sys/kernel/random/uuid || exit mv -i -- "$file" "$uuid" || ret=$? done exit "$ret")
Stéphane Chazelas's user avatar
0 votes

rename - move [ ] delimited part of filename to end of filename

What I would do: $ rename -n 's/^(\[.*?\])(.*)/$2 $1/' *393933939339* rename([2022] This is a Test - This is a Test (some stuff) [393933939339], This is a Test - This is a Test (some stuff) [...
Gilles Quénot's user avatar

Top 50 recent answers are included