S3Sync.net

General Category => Closed Bugs => Topic started by: lejarrag on October 18, 2007, 09:28:13 AM



Title: Weird behavior of --delete option when downloading with trailing slash.
Post by: lejarrag on October 18, 2007, 09:28:13 AM
When I download from Amazon S3 using a trailing slash in the source address, s3sync tries to delete the whole directory that I am downloading.  For example, suppose I upload first the directory dir:

        ./s3sync.rb -r --delete /root/tmp/dir bucket:pre

Here everything works fine and some keys pre/dir, pre/dir/file1, pre/dir/file2, etc are created in "bucket", whereas other stuff is deleted.  Now if I try to download:

        ./s3sync.rb -r --delete bucket:pre/dir/ /root/tmp/dir

it downloads the stuff as it should, but it warns me with the message:

"Could not delete directory /root/tmp/dir: directory not empty"

This warning is not totally idle:  if the directory happens to be empty, it erases it.  It seems to me that this shouldn't happen.  The above command should just copy the "files and directories" with prefix "pre/dir" to /root/tmp/dir, deleting files and directories in /root/tmp/dir that don't appear in S3, but not try to delete the directory /root/tmp/dir.  I tried different variations on this, and the culprit seems to be the trailing slash /.


Title: Re: Weird behavior of --delete option when downloading with trailing slash.
Post by: ferrix on November 17, 2007, 08:41:13 PM
Fixed @1.2.1