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

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Georgian

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

Post 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 . . . ?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

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

Post by gm10 »

Just use quotes for filenames with spaces or other special characters in them.
srq2625

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

Post 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.
Georgian

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

Post by Georgian »

That works! Thank you :)
Locked

Return to “Other topics”