Page 1 of 1

[SOLVED]Is it possible to modify a batch of file names...?

Posted: Thu Aug 16, 2018 10:15 am
by Georgian
I have a number of pictures that I want to resize using Imagemagick - the files were saved with spaces in the file names which seems to be incompatible with IM. Is there a way that I can remove the spaces from the file names other than manually renaming each one . . . ?

Re: Is it possible to modify a batch of file names...?

Posted: Thu Aug 16, 2018 10:33 am
by gm10
Just use quotes for filenames with spaces or other special characters in them.

Re: Is it possible to modify a batch of file names...?

Posted: Thu Aug 16, 2018 10:39 am
by srq2625
Check out this page. The rename works a real treat.

To remove spaces

Code: Select all

rename -v 's/\ /_/g' *
should come real close to replacing any space characters with the under-score character. The 'g' should replace any number occurrences. The '-v' argument just makes it verbose.

Re: Is it possible to modify a batch of file names...?

Posted: Thu Aug 16, 2018 10:46 am
by Georgian
That works! Thank you :)