Why would AssetDatabase.CopyAsset return false?

I’m trying to set up a build script that will copy a music file to a /Resources folder so that I can use one project that has the ability to do Resources.Load in standalone (i.e. big download) built versions but can do streaming for the web version.

My script looks something like this:

static void PrepBundledResources()
{
	var baseBundledPath = "/Platform Resources/StandaloneVersions";
	var baseResourcesPath = "/Platform Resources/Resources";
	var assets = EditorUtils.GetObjectsAtPath( baseBundledPath, null );
	VerifyDirectoryExists( Application.dataPath + baseResourcesPath );
	AssetDatabase.Refresh( ImportAssetOptions.TryFastReimportFromMetaData );

	foreach( var asset in assets )
	{
		var assetPath = AssetDatabase.GetAssetPath( asset );

		var destinationPath = "/Assets/Platform Resources/Resources" + assetPath.Substring( assetPath.LastIndexOf( baseBundledPath ) + baseBundledPath.Length );
		Debug.Log( "Copying bundled asset " + assetPath + " to " + destinationPath );
		if( !AssetDatabase.CopyAsset( assetPath, destinationPath ) )
		{
			Debug.LogError( "Copy asset failed on " + assetPath + " to go to " + destinationPath );
		}
		AssetDatabase.ImportAsset( destinationPath );
	}
	AssetDatabase.Refresh( ImportAssetOptions.TryFastReimportFromMetaData );
}

GetObjectsAtPath is a helper method I wrote that gets files recursively. VerifyDirectoryExists just creates the directory if it doesn’t exist.

The problem I’m running in to is that I’m hitting the error inside the if statement with the copy asset.

In my case this problem have been solved by changing destination path to one that contains name of the new file (not only directory). Unfortunately, documentation does not mention this like FileUtils.FileUtil.CopyFileOrDirectory does.

I have encountered this issue today.
In my case this problem was the meta file broken, that caused by SVN conflict.
Just revert meta file is works for me.