T
T
Tsarev Vadim2021-05-26 14:51:05
linux
Tsarev Vadim, 2021-05-26 14:51:05

How to rename and clean up filenames with regex on linux?

How to rename and clean up filenames using regex on linux, ubuntu, etc (there are a lot of files)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2021-05-26
@saboteur_kiev

Take and clean.
Without concrete examples, it is not known what to say.
Well, the rename utility can do regexp

A
Alexey Cheremisin, 2021-05-26
@leahch

The find command supports regexp (and more)
For example

$ find . -regextype sed -regex ".*/[a-f0-9\-]\{36\}\.jpg"
./test/81397018-b84a-11e0-9d2a-001b77dc0bed.jpg
./81397018-b84a-11e0-9d2a-001b77dc0bed.jpg

Well, if you find anything
find . -regextype sed -regex ".*/[a-f0-9\-]\{36\}\.jpg" --exec rm {} \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question