Home >Backend Development >PHP Tutorial >Python script to calculate the size of all directories under a specified path_PHP tutorial
To detect the size of files in a specified directory, you only need to traverse the directory and then count the files and summarize them. Let’s see below A python script to detect the size of all directories under a specified path
Example
The code is as follows | |||||
import os,sys
def lsdir(rootDir):
targetDir = sys.argv[1]
|