Diego
Diego

Reputation: 17140

Batch rename of files with similar names

I have a series of files named like such:

file 1.jpeg
file 2.jpeg
file 3.jpeg
...
file 40.jpeg

I would like remove the space from all of their filenames without having to individually do it. I know its possible using something like: file{1,40}.jpeg or something like that but i can't remember and I don't even know how to search for it.

Thanks!

EDIT: linux

Upvotes: 2

Views: 910

Answers (1)

Guido
Guido

Reputation: 47665

http://www.google.es/search?q=shell+rename+similar+files+in+a+directory

The first result is http://www.debian-administration.org/articles/150

Using the perl rename command [...] we can also, for example, strip spaces from filenames with this:

~$ rename 's/ //' *.jpeg

In other posts I've found this kind of commands that do not require perl:

for f in *; do mv "$f" `echo $f | tr --delete ' '`; done

I've not tried any of them.

Upvotes: 4

Related Questions