Skip to main content

Hi all,



I have been currently tasked to automate the transfer of reports on a network drive to a shared folder on box. I was told to use box cli in conjunction with batch scripting to complete this. I have hit a roadblock in the creation of said script, and was looking for some additional perspective, as I may have missed a command or argument. Attached below is the “script” I tried to create for this project:



robocopy "\\Network Folder" "\\Network Folder Archive" /MOV *.xlsx



box folders:upload "\\Network Folder Archive" --parent-folder=(Shared Box Folder ID)



The roadblock I have hit is in the transfer to box. Because box cli doesn’t overwrite folders, I cannot update the folder with new reports that come in. The other direction I wanted to take was to upload all of the files in the folder directly to box, but I couldn’t find a command to send all of the files to box at once. I experimented with the bulk csv commands, but because the monthly reports are going to have different file names each month, I couldn’t find a way to make the script function without a form of manual intervention.



I understand that this use case likely doesn’t function well with box cli, but I wanted to see if anyone had any ideas that I was oblivious to. Thank you all!

Hi @jmf



This is expected behavior for the upload folder box cli command, to avoid overwriting content.



Can you confirm if you actually want to overwrite the content?



Besides uploading to another folder, there is the option to create new versions of the files with the new content.



Let us know what best suits you and also if you have access to any other tool beyond the CLI. For example would a python script be acceptable?



I suspect we need to test if the file already exists in Box, and then decide if we want to overwrite it, or create a new version. Similar for folders, if they already exist we can skip the creation.



Cheers


Rui,



Thank you for reaching out! Fortunately, I was able to resolve the situation by making timestamped folders, assigning it to a variable, then uploading the created folder via box cli. I just needed to make adjustments to my script details prior to moving to box cli. So, as of now the issue should be resolved. Thank you for your input, I appreciate it.


That works!!!



Cheers


Reply