Welcome to the new Box Support website. Check out all the details here on what’s changed.

Trouble creating a new file from R using box_dir_create in boxr

Answered
New post

Comments

2 comments

  • cbetta

     I'm not familiar with this library, but in general the parent is a folder ID, not a name. Use folder `0` for the root folder.

    0
    Comment actions Permalink
  • RegenexxPRC
    Hi all,
     
    I got an answer via the package's developer, and I figured I'd pay it forward for any fellow travelers in the future.

    It turns out that box_setwd() sets a default directory but returns nothing. Using

     

    box_dir_create(dir_name="TEST", parent_dir_id = "###########")

     

     

    creates the folder successfully. It will not do so if a folder of the same name is already created.

    After more digging, I was also told that box_dir_create() is quietly passing back a lot of useful information, including the newly created directory's ID. To access it you can save the function results as a variable, like so:

     

     

    b <- box_dir_create("test_dir")
    
    names(b) # lots of info
    
    b$id # what you want
    
    box_ul(b$id, "image_file.jpg") # is this file by file? 
    box_push(b$id, "image_directory/") # or a directory wide operation?

     

     

    Thanks for your help, and I hope this helps someone else down the road. Cheers!

    0
    Comment actions Permalink

Please sign in to leave a comment.