S3Sync.net
February 02, 2014, 01:28:21 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Weird behavior of --delete option.  (Read 2294 times)
lejarrag
Newbie
*
Posts: 16


View Profile
« on: October 15, 2007, 04:34:27 PM »

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 /.

Workaround: don't use the trailing slash.  The command

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

seems to work fine with no warnings.  The only disadvantage is that you can't rename dir to something else (say dir2) within the s3sync command.

I'll appreciate any clarification or discussion on this.  There may be some logical explanation for this that I can see at the moment.
« Last Edit: October 15, 2007, 10:34:37 PM by lejarrag » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!