Skip to main content
Question

How to get the size of the file in the box using python

  • May 22, 2025
  • 2 replies
  • 19 views

Forum|alt.badge.img

Hi,

 

How to get the size of the file in the box. Currently I am using below code but i doubt this is the best way to do. 

 

    client.file(file_id='29***phone number removed for privacy***').content()

 

My files are structured or unstructured PDFs. I want to move the files to a different folder if they are bigger than 200kb in size.

2 replies

Forum|alt.badge.img

 The following will give you the size of the file, in bytes:

 

file_size = client.file(file_id).get().size

Forum|alt.badge.img

Thanks for the response. It seems the code is working same as

 

    len(client.file(file_id='file id').content())