Skip to main content
Solved

Replace spaces in file name with dashes

  • November 29, 2023
  • 2 replies
  • 236 views

vxn43
Supporter
Forum|alt.badge.img+18

I have 200 files. Their names have spaces. I want to replace these spaces in each file name with a dash. What is the best way to do this. I know I start with the pathnames reader. But, what is the next transformer(s) I need to add?

Best answer by takashi

Hi @timh ,

Alternatively, you can use File Copy writer (File Operation: Move) to rename files within a folder.

Rename "path_unix" read by the PATH reader to "filecopy_source_dataset".

Set your desired destionation filename to "filecopy_dest_filename".

Set "." (dot) to the Subfolder parameter in the File Copy writer feature type.

Set "Move" to the File Operation parameter of the File Copyt writer.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+61

When I need to do this I use a SystemCaller and the dos rename command.


takashi
Celebrity
  • Best Answer
  • November 29, 2023

Hi @timh ,

Alternatively, you can use File Copy writer (File Operation: Move) to rename files within a folder.

Rename "path_unix" read by the PATH reader to "filecopy_source_dataset".

Set your desired destionation filename to "filecopy_dest_filename".

Set "." (dot) to the Subfolder parameter in the File Copy writer feature type.

Set "Move" to the File Operation parameter of the File Copyt writer.