Skip to content

Commit

Permalink
blobcopy maintains virtual dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
kpfaulkner committed Jul 10, 2017
1 parent c41b2ea commit a27d8c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
23 changes: 13 additions & 10 deletions azurecopy/Handlers/AzureBlobCopyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public static void StartCopyList(IEnumerable<BasicBlobContainer> origBlobList, s
{
try
{
Console.WriteLine("Copy blob " + blob.DisplayName);
var bcd = AzureBlobCopyHandler.StartCopy(blob, destinationUrl, destBlobType, skipIfExists);
if (bcd != null)
{
Expand Down Expand Up @@ -164,7 +163,6 @@ public static void StartCopyList(IEnumerable<BasicBlobContainer> origBlobList, s
// new name should be destination name + (blob.name - blob.prefix)
public static BlobCopyData StartCopy(BasicBlobContainer origBlob, string DestinationUrl, DestinationBlobType destBlobType, bool skipIfExists)
{

var client = AzureHelper.GetTargetCloudBlobClient(DestinationUrl);
var opt = client.GetServiceProperties();

Expand All @@ -185,23 +183,28 @@ public static BlobCopyData StartCopy(BasicBlobContainer origBlob, string Destina
{
blobWithoutPrefix = origBlob.Name.Substring(origBlob.BlobPrefix.Length);
}

if (!string.IsNullOrWhiteSpace(blobWithoutPrefix))
{
blobName = string.Format("{0}/{1}", destBlobPrefix, blobWithoutPrefix);
if (!string.IsNullOrWhiteSpace(destBlobPrefix))
{
blobName = string.Format("{0}/{1}", destBlobPrefix, blobWithoutPrefix);
}
else
{
blobName = blobWithoutPrefix;
}

}
else
{
// need to get just filename. ie last element of /
var actualBlobName = origBlob.Name.Split('/').Last();

{
if (string.IsNullOrWhiteSpace(destBlobPrefix))
{
blobName = actualBlobName;
blobName = origBlob.Name;
}
else
{
blobName = string.Format("{0}/{1}", destBlobPrefix, actualBlobName);
blobName = string.Format("{0}/{1}", destBlobPrefix, origBlob.Name);
}
}

Expand Down
4 changes: 2 additions & 2 deletions azurecopy/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyFileVersion("1.4.3")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
4 changes: 2 additions & 2 deletions azurecopycommand/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyFileVersion("1.4.3")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]

0 comments on commit a27d8c1

Please sign in to comment.