Skip to main content
Question

Number of files in Box folder does not match Actual files .

  • May 22, 2025
  • 6 replies
  • 56 views

Forum|alt.badge.img

My folder Fy2016 shows 74,813 files.

My folder Fy2016/employ shows 338 files.

The script lists out 75,423 files from box folder Fy2016.

The script lists out 364 files from box folder Fy2016/Employ

Why are the numbers so different?

I'm the one that uploaded 75,423 to box.

I'm new to python. Below  I wrote a script to read file names from box folder.

 

from boxsdk import OAuth2, Client
import json, csv
import time

auth = OAuth2(
client_id='s_MYCLIENTID',
client_secret='MY_CLIENT_SECRET',
access_token='MY_ACCESS_TOKEN',
)
# Timer starts
starttime = time.time()
client = Client(auth)
user = client.user().get()
print('********_starting')
print('The current user ID is {0}'.format(user.id))

root_folder = client.folder('MY_FOLDER_ID')
root_folder_with_info = root_folder.get()
print('_a_root_folder_with_info_=_ {0}'.format(root_folder_with_info))
items = list(root_folder.get_items(limit=90000))

item2s = root_folder.get_items()
fname = "output_18err.csv"
arrx = []
try:
for item in item2s:
arrx.append([item.name])
except Exception as e:
print( getattr(e, 'message', repr(e)))
with open(fname, 'w') as f:
csv.writer(f, lineterminator='\n').writerows(arrx)

fname = "output_18.csv"
with open(fname, 'w') as f:
csv.writer(f, lineterminator='\n').writerows(arrx)
time_lapsed = time.time() - starttime
mins = time_lapsed // 60
sec = time_lapsed % 60
hours = mins // 60
mins = mins % 60
print("Time Lapsed = {0}:{1}:{2}".format(int(hours),int(mins),sec))
print('_a_finished')

BOX1_nPYR94P-UjfhHUKgQAfKNw.png

BOX1_07H9K3732ajgkhvzrwadVg.png

6 replies

Forum|alt.badge.img

Here is the 2nd screenshot for folder Employ

BOX1_lph4tMtSPdVj5ixUyPn2kg.png


Forum|alt.badge.img

Sometimes the Web App can take a little while to update, especially during large file operations. The number should be right soon, if it is not already. 

Thanks, 

Alex, Box Developer Advocate


Forum|alt.badge.img

I uploaded those files on Jan. 4, 2022 to both folders.

Today is Jan. 6, 2022,  Employ still shows I have 338 files

and Fy2016 has 74,813 files.


Forum|alt.badge.img

hmmm. You might reach out to support for this. I don't have access to the same support tools they do. 

Alex


Forum|alt.badge.img

Follow up from support team ( I hope it help others )

Support team said 

Sometimes Box caches previous file counts and storage amounts causing a data inconsistency. This is a known issue and is a long term project for our engineering team to tackle.

Thanks for the info.


Forum|alt.badge.img

Sweet. Thank you for adding this. Appreciate it.