find
and rename
should do the trick
strawman example:
to go from
...
├── foo/
│ ├── file name with spaces
│ └── bar/
│ └── another file with spaces
...
you can use
find foo/ -type f -exec rename 's/ //g' '{}' \;
to get
...
├── foo/
│ ├── filenamewithspaces
│ └── bar/
│ └── anotherfilewithspaces
...
in your case:
in your case, it would be something like
find path/to/files/ -type f -exec rename 's/ //g' '{}' \;
but you can use fancier filters in your find command like
find path/to/files/ -type f -name *.log* -exec rename 's/ //g' '{}' \;
to select only .log
files in case there are other file names with spaces you don't want to touch
heads up:
as pointed out in the comments there's the potential to overwrite files if their names only differ by space placement (e.g., a bc.log
and ab c.log
if carelessly renamed would end up with a single abc.log
).
for your case, you have two things on your side:
rename
will give you a heads up as long as you're not using it's --force
option
and will give you a helpful message like ./ab c.log not renamed: ./abc.log already exists
- your files are named programatically, and you're stripping the spaces in dates, so, assuming that's all you have in there, you shouldn't have any problems
regardless, it's good to be mindful of this sort of thing