Excluding an item in a for loop

Viewed 166

I am trying to find the total size of a root directory on an FTP server. However, I do not have access to one of the directories in the root.

I want to use this function to sum the sizes of the directories in the root:

size = 0
for filename in ftp.nlst("."):
    ftp.cwd(filename)
    size += ftp.size(".")    
print(size)

This generates the error:

ftplib.error_perm: 550 Could not get file size.

I can't find any documentation about excluding an item from a for loop.

1 Answers
Related