On a fileserver at work, we have a bunch of old directories made on macOS (that was previously on an AFP share) that has / in the name. I would like to replace / with -, but am having a hard time doing that. Also some of the directories also contain <space> that complicates things even further.
Example directories with forward slash:
Brief/Debrief(shows up asBrief:Debriefin Linux cli)Til/fra kunde(shows up asTil:Fra kunderin Linux cli)
I would like to rename them to be Brief-Debrief and Til-Fra kunde, i.e replacing / with -
I have tried with find and -exec mv … on OmniOS, but I have not managed to get the forward slash (and especially not when there is a <space> in the name also.
I can use an Ubuntu VM that access the share via NFS, and there I have access to rename, etc., but I'm still having issues.
Any input on how to solve this?
EDIT:
As per @Kamil Maciorowski suggestion, all I needed to look for was :, and presto.
Final command:
find . -name "*:*" -type d -execdir rename -n 's/:/-/g' "{}" \;
(remove the -n flag if you copy this, -n = dry run)
1 Answer
As per @Kamil Maciorowski suggestion, all I needed to look for was :, and presto.
Final command:
find . -name "*:*" -type d -execdir rename -n 's/:/-/g' "{}" \;
(remove the -n flag if you copy this, -n = dry run)