Thanks all for the suggestions and assistance. I ended up using a python caller earlier in the workbench to replace any spaces in the actual file names with underscores.
From
rest areas/rest areas.shp
rest areas/rest areas.dbf
To
rest_areas/rest_areas.shp
rest_areas/rest_areas.dbf
The end result
For those interested here is my python code:
import fmeobjects
import os
class renameFeature(object):
def __init__(self):
self.folder_map = {}
def input(self, feature):
original_path = os.path.normpath(feature.getAttribute('path_unix'))
directory, filename = os.path.split(original_path)
if directory not in self.folder_map:
new_directory = directory.replace(" ", "_")
if new_directory != directory:
try:
if not os.path.exists(new_directory):
os.rename(directory, new_directory)
self.folder_map[directory] = new_directory
except Exception as e:
feature.setAttribute('rename_dir_error', str(e))
self.folder_map[directory] = directory
else:
self.folder_map[directory] = directory
else:
new_directory = self.folder_map[directory]
original_full_path = os.path.join(new_directory, filename)
new_filename = filename.replace(" ", "_")
new_path = os.path.join(new_directory, new_filename)
try:
if new_filename != filename:
os.rename(original_full_path, new_path)
feature.setAttribute('rename_status', 'renamed')
else:
feature.setAttribute('rename_status', 'unchanged')
feature.setAttribute('_clean_filename', new_path)
except Exception as e:
feature.setAttribute('rename_error', str(e))
feature.setAttribute('_clean_filename', original_full_path)
self.pyoutput(feature)
def close(self):
pass