# replace spaces in filenames

**URL:** <https://forum.ansible.com/t/replace-spaces-in-filenames/36455>\
**Category:** Ansible Project\
**Created:** [March 17, 2022, 12:49pm UTC](https://forum.ansible.com/t/replace-spaces-in-filenames/36455 "2022-03-17T12:49:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [March 17, 2022, 12:49pm UTC](https://forum.ansible.com/t/replace-spaces-in-filenames/36455/1 "2022-03-17T12:49:59Z")

</div>

hi everybody,

I have a situation where I need to replace spaces in filenames on a large scale.  
Is there any way to do this with Ansible?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 17, 2022, 8:40pm UTC](https://forum.ansible.com/t/replace-spaces-in-filenames/36455/2 "2022-03-17T20:40:45Z")

</div>

yes, but for that specific task i would use the `rename` command with  
expressions

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [March 18, 2022, 12:35am UTC](https://forum.ansible.com/t/replace-spaces-in-filenames/36455/3 "2022-03-18T00:35:21Z")

</div>

There are accepted patches in the pipeline which add an “–all” parameter to the `rename` command, so you can replace all the spaces in one go instead of just the first one. Alas, that has not made it to a released version yet. Soon, though, I hope.
