[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 please read how to get help
Post Reply
Georgian
Level 1
Level 1
Posts: 10
Joined: Tue Apr 22, 2014 3:37 am

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

Post by Georgian » Thu Aug 16, 2018 10:15 am

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 Georgian on Thu Aug 16, 2018 10:47 am, edited 1 time in total.

gm10
Level 10
Level 10
Posts: 3409
Joined: Thu Jun 21, 2018 5:11 pm

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

Post by gm10 » Thu Aug 16, 2018 10:33 am

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

srq2625
Level 4
Level 4
Posts: 339
Joined: Tue Jan 08, 2013 11:35 am
Location: State: Constant Confusion, Country: D'oh

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

Post by srq2625 » Thu Aug 16, 2018 10:39 am

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
Level 1
Level 1
Posts: 10
Joined: Tue Apr 22, 2014 3:37 am

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

Post by Georgian » Thu Aug 16, 2018 10:46 am

That works! Thank you :)

Post Reply

Return to “Other topics”