Please use the below script to clear downloaded data of all users
Explanation:
Script will find download folder of all users
Deletes all files and folders of each download folder
import os
uPath = 'C:\\Users'
lDirectories = os.listdir(uPath)
dPaths = []
for eDir in lDirectories:
uNPath = os.path.join(uPath, eDir)
try:
lSDs = os.listdir(uNPath)
for eSD in lSDs:
if eSD.lower() == 'downloads':
dPaths.append(os.path.join(uNPath, eSD))
else:
continue
except Exception:
pass
for dPath in dPaths:
try:
os.popen('FOR /D %p IN ("'+dPath+'\\*.*") DO rd "%p" /s /q').read()
os.popen('del "'+dPath+'\\*" /F /Q').read()
print(os.popen('dir "'+dPath+'"').read())
except Exception:
pass
Sample Output: