0
votes

We are using azcopy to transfer the contents of a web application to azure file service in a cloud migration project. The issue is it does not copy the empty folders by default. So after content transfer, application throws exception in many cases where it expects the folder structures to be present. My question is is there any command to copy including the emlty folders in az copy??

I checked the documentation. There it is mentioned that upload and download of empty folders is not done in azcopy. For copying, it is not mentioned.... so we were looking for some commands to do the same but unable to find any. Is this even possible with the tool??

Thanks in advance.

1

1 Answers

1
votes

AzCopy does not copy empty folders, as you discovered, so what you'd need to do is to recreate the folder structure. Some PowerShell commands to do this are:

(gci C:\Scripts -r | ? {$_.PSIsContainer -eq $True}) | ? {$_.GetFiles().Count -eq 0} | select FullName

(Powershell example from this article)

This PowerShell line gives you a list of all empty folders. You can then pass that list over to your folder creation routine to solve your problem.