0

I'm uploading a file from blob storage to an Azure Task which gets uploaded to the task VM's wd directory. I can access the file fine from the executing task. I upload the file with:

var filename = "myFile.txt";
ResourceFile myResource = new ResourceFile(blobURL,
                  fileName);


 List<ResourceFile> taskFiles = new List<ResourceFile>();
 taskFiles.Add(myResource);

 task.ResourceFiles = taskFiles;
 job.AddTask(task);

My question is, I'd like to specify a directory for the file at the point of setting the task up. (So to have the file located in wd\MyDirectory\myFile.txt") Does anyone know if this is possible, and if so how?

Emre Bolat
  • 4,316
  • 5
  • 29
  • 32
NDJ
  • 5,189
  • 1
  • 18
  • 27

1 Answers1

2

Specifying the directory as part of the filename works (I had previously thought not) - so in the end I have:

var filename = @"MyDirectory\myFile.txt";
ResourceFile myResource = new ResourceFile(blobURL,
                  fileName);

and myFile.txt is placed within the wd\MyDirectory directory on the target vm.

NDJ
  • 5,189
  • 1
  • 18
  • 27
  • 1
    Hiya @NDJ, what you have done is fine, also in the `vm` you can access the working directory via environment settings but that's completely separate thing: I just thought I will mention that once your resource is available in `vm` you can access the working dir using `AZ_BATCH_TASK_WORKING_DIR` env var. more detail here: https://azure.microsoft.com/en-us/documentation/articles/batch-api-basics/#environment-settings-for-tasks . Oh an you should accept this as answer I reckon. – Tats_innit Jul 11 '16 at 03:15