Subject: RE: [netatalk-admins] Samba & Netatalk

From: "Alex Yu" <[email-masked]>
Date: Fri, 19 Nov 1999 12:51:11 -0500

> Thats a good question..... I will try to see if it works for me....
> Is the .AppleDoubles the same user as the ftp client?

Most every directory has the .AppleDoubles folder if it is on atalkd share.
When you attempt to delete a directory through smb, smb will force to delete
all the sub files and directories with any questions.  But in ftp, let's say
you use CuteFTP, WS_FTP, or any other third party ftp applications, this is
how they work.

When you try to delete a directory,

/home/user/a

ftp application will go into a folder, list all sub files/directories into
memory, and remove each file individually.  So you will not be able to rmdir
since .AppleDoubles is still exists.

Maybe we should hack the ftp serivce, and force it to delete .AppleDoubles
if it is exists?

ayu

---

From: "Jonathan Newman" <[email-masked]>
Date: Fri, 19 Nov 1999 10:09:12 -0800

> Maybe we should hack the ftp serivce, and force it to delete .AppleDoubles

I ran across a Perl script that fixed this problem by deleting the files in the
.AppleDouble directories that had no corresponding match.  Perhaps this Perl
script could be run as a cron to cleanup the issues you outlined.

Credit for this script goes to

Brian Wagner
[email-masked]

Usage:
perl AppleDoubleCheck /theDirToCheck
  will report any unattached resource files.

perl AppleDoubleCheck -d /theDirToCheck
  will delete unattached resource files.

Use -r to see unattached resource files recursively. Use -rd to delete
them.

===================================

#!/usr/bin/perl

if ($ARGV[0] =~ /^\-/)
{
        $source=$ARGV[1];
        if ($ARGV[0] eq '-d')
                { $remove=1;}
        elsif ($ARGV[0] eq '-r')
                { $recursive=1;}
        elsif (($ARGV[0] eq '-rd')||($ARGV[0] eq '-dr'))
                { $recursive=1;
                        $remove=1;}
        else {die("Bad switch\n");}
}else {
        $source=$ARGV[0];
}

&checkDir($source);

sub checkDir {
        my($sourceDir,$checkDir)=@_;
        my ($file,@chklist,@srclist);
        $checkDir=$sourceDir."/.AppleDouble";
        print "Checking $sourceDir\n";
        if (opendir(CHK,$checkDir))
        {
                @chklist=grep(!/^\./,readdir(CHK));
                closedir(CHK);

                foreach $file (@chklist)
                {
                        if (! -e "$sourceDir/$file")
                        {
                                if ($remove)
                                        {
                                                print "Removing:
.AppleDouble/$file\n";
                                                unlink("$checkDir/$file");
                                        }
                                else
                                        { print "Missing:$file\n";
                                        }
                        }
                }
        }
        if ($recursive) {
                opendir(SRC,$sourceDir);
                @srclist=grep(!/^\./,readdir(SRC)); #get dirs
                closedir(SRC);
                foreach $file (@srclist)
                {
                        if (-d "$sourceDir/$file")
                        {
                                &checkDir("$sourceDir/$file");
                        }
                }
        }
}

---

From: "Alex Yu" <[email-masked]>
Date: Fri, 19 Nov 1999 14:25:44 -0500

> I ran across a Perl script that fixed this problem by deleting
> .AppleDouble directories that had no corresponding match.

Dear Jon,

I am very appreciate that you take the time and wrote this awesome perl
script, but I don't think it will solve the problems for administrators who
hide .AppleDoubles in their ftp services.  If anyone of you is interested to
hack the WU-FTPD source code, please join me!

ayu