Re: backing up using rsync+netatalk


Subject: Re: backing up using rsync+netatalk
From: Jesse (jg@floridasunonline.net)
Date: Fri Sep 14 2001 - 12:44:43 EDT


On Friday 14 September 2001 04:20, Nicky Haan wrote:
> Is there a rsync client/server for mac ? and if so, what does it do when i
> move files from mac to linux if the filenames arnt something my
> linuxmachine likes ? i already have that problem no when i use a program
> link syncfolders on mac to my appleshare that files containing / \ * # :
> and so on, arnt usable anymore (and yes i know i should tell our macusers
> not to do that but i'm already telling them for over a year and they still
> are using those filenames .. :(( )
>
> so to resume, is there a rsync client and or server for mac and what does
> it do with those file(names)
>
> grtz
>

I had the same problem with a large number of filenames with some documents I
needed to process with the shell. I don't know that this will help with
backups but if you need to fix bad filenames that will be processed with the
shell I wrote this script. (watch the email line wrapping )

#!/bin/bash

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# This script will attempt to remove characters which may be
# unfriendly to the shell from the filenames of the
# files located in the directory in which it is executed and replace
# them with an underscore character. It's currently disabled
# you'll need to uncomment the mv line below.

self=`basename ${0}`

if [ -z $1 ]; then
        printf "\nUsage: %s\n" ${self}
        printf "\t%s takes a directory as an argument\n" ${self}
        printf "\tthe argument should be an absolute path\n"
        printf "\tto the directory.\n"
        printf "\n"
        printf "For example:\n"
        printf "\t%s /home/guest/directory_to_process\n\n" ${self}
        exit 1
fi

for item in $1/*
do
        # Need this so we are comparing filenames correctly
        item=`basename "${item}"`

        # exclude the script from processing
        if [ "${item}" = "${self}" ]; then
                continue
        fi

        # skip directories
        if [ -d "${item}" ]; then
                continue
        fi

        current_name="${item}"
        fixed_name=`echo -n \'${current_name}\' | sed
's/[[:blank:][:cntrl:][:punct:]\(\)\{\}]/_/g'`

        # Uncomment the mv command below when ready to use
        #mv "${1}/${current_name}" "${1}/${fixed_name}"

        # comment out the echo command below once your satisfied
        echo ${1}${fixed_name}

done



This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:52 EDT