'AzCopy not transferring any files

So my copy line looks like this.

.\azcopy copy $source $destination --recursive=TRUE

Where $source is a list I iterate through in a for each loop. And destination is a Uri containing sas which is retrieved by another function.

My sources are network shared folders like so:

$Sources = @(
  '\\computer\folder name\folder\*.zip',
)

A list of about five file paths on the same remote machine.

I'm troubleshooting with just the first filepath with the *.zip and there is a folder with a space in the middle like displayed.

My problem is that it all seems to run fine, but doesn't transfer any files and doesn't detect and files to transfer. There is one zipped folder in there.

Files to transfer = 0

Log file contains no errors and states that it completed successfully.

Any ideas?

F.y.i it works fine when running against a local file not a remote FileShare.



Solution 1:[1]

You can't use hastables in the format that you are using instead you should be using arrays.

Example :

$hashtable = @{
1="\\server\sharename\path\file"
2="\\server\sharename\path\file"
}

$array=@(
"\\server\sharename\path\file"
"\\server\sharename\path\file"
)

I tested the same requirement in my environment where I have a file share mapped to my machine like below :

enter image description here

There are two ways to perform a copy using azcopy from netowrk share to azure storage container :

Solution 1 using UNC path :

$destination= "https://<StorageaccountName>.blob.core.windows.net/testdestination?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-02-16T14:17:41Z&st=2022-02-16T06:17:41Z&spr=https&sig=<Redacted>"
$Sources = @(
  "\\cloudshellansuman.file.core.windows.net\ansutest\testzipfolder\*.zip"
  "\\cloudshellansuman.file.core.windows.net\ansutest\testdocfolder\AADSTS54005.docx"
)

ForEach($Source in $Sources){
  .\azcopy copy $Source $destination --recursive=true
}

enter image description here

Solution 2 using Mapped Drive if the above doesn't work :

$destination= "https://<StorageaccountName>.blob.core.windows.net/testdestination?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-02-16T14:17:41Z&st=2022-02-16T06:17:41Z&spr=https&sig=<Redacted>"
$Sources = @(
  'Z:\testdocfolder\AADSTS54005.docx'
  'Z:\testzipfolder/*.zip'
)

ForEach($Source in $Sources){
  .\azcopy copy $Source $destination --recursive=true
}

enter image description here

Output:

enter image description here

Note: I am using azcopy version 10.13.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AnsumanBal-MT