Square dot error connecting to Mac share from Windows

Square dot error connecting to Mac share from Windows

Lucidica is the IT support team for London businesses. 

Thanks for viewing this page, hopefully it helps you solve your technical issue if not feel free to drop us a line here and we’ll provide additional help and support.

Image result for connection failed icon

The issue:

Random folders within the share on Mac got renamed and a space was added to those folders. As you may know Windows does not allow spaces in the end of the folder name therefore when you connect to that Mac share from a Windows machine a square dot was added (replacing the space).

The above can create all sort of complications when it comes to file referencing.

The solution:

Run the script attached from a root directory of the share with sudo privileges.

What script does:

It looks for folders with space at the end of their names and removes that space.

Script:

#!/bin/bash

EDIT_ME_STARTING_DIR=”.”

find “$EDIT_ME_STARTING_DIR” -depth -name “* *” | perl -ne ‘   # Find all files with a space in them

    chomp;                      # remove newline character

 

  if ( /(.*\S)\s+$/ ) {       # find files with trailing spaces

        #

        # The above (…) notation says save what is found in $1

        # The .* says match anything

        # The \S says match anything except a space

        # The \s+ say match 1 or more spaces

        # The $ say match end of string

        # The (…) does not including any of the trailing spaces

        #

         rename $_, $1;          # rename without the spaces

         next;                   # get the next name from the find command

    # ignore all remaining files with spaces in them

Hope this helps!