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

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: small change for directory handling  (Read 2881 times)
ongle
Newbie
*
Posts: 1


View Profile
« on: October 04, 2009, 12:00:18 PM »

Thanks for this tool, so far it is working well and it would have saved me a lot of time in the past if I hadn't been so focused on finding GUI tools. I'm using this under Windows if it matters.

Anyways, I have been needing to migrate over a terabyte of data out of S3 but the GUI tools I had been using in the past to put the data into S3 were failing me or were too cumbersome for this task. So I gave this a try and right away I had an issue with directories. It seems that one or more of the GUI tools had created placeholder files for directories in S3 and the script would first find this file then later encounter an error when it tried to create a directory under the same name.

E.g.:
bucket:2007
bucket:2007/blah.ext
s3sync would create the file 2007 then fail when it tried to create the 2007 directory.

So this is my patch which may help someone else so I thought I would share. So far it is working for me. I have no idea what broader implications this change may have.

Around line 322 in s3sync.rb  right after:

Code:
debug("S3 item #{item.name}")
I changed this:

Code:
g.yield(S3Node.new(bucket, prefix, item))
to this:

Code:
if item.name == path and $S3syncOptions['--make-dirs']
debug("item found with path name #{path}, skipping due to --make-dirs")
else
g.yield(S3Node.new(bucket, prefix, item))
end
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!