New answers tagged rename
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 - ...
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[...
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 ...
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")
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) [...
Top 50 recent answers are included
Related Tags
rename × 1200bash × 282
files × 236
shell-script × 179
filenames × 156
shell × 130
linux × 124
find × 110
mv × 103
regular-expression × 71
command-line × 68
scripting × 65
directory × 64
sed × 50
file-copy × 31
macos × 31
perl × 28
cp × 28
recursive × 27
date × 22
awk × 21
ubuntu × 20
terminal × 19
zsh × 19
wildcards × 19