Python Forum
Search for files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Search for files (/thread-7575.html)



Search for files - raopatwari - Jan-16-2018

I need to find files in dir path which are greater than zero bytes and print them


RE: Search for files - j.crater - Jan-16-2018

Hello, is this a homework assignment?

Show us what you have tried. Post the code in Python code tags and errors in error tags, and we will assist the best we can.


RE: Search for files - raopatwari - Jan-16-2018

dir_path='/development0/tep/install/D175122/script/'
def is_non_zero_file(dir_path):
    return os.path.isfile(dir_path) and os.path.getsize(dir_path) > 0
file_list=is_non_zero_file()
pirnt(file_list)


RE: Search for files - Larz60+ - Jan-16-2018

You need to pass the dir_path argument to is_non_zero_file
file_list = is_non_zero_file(dir_path)



RE: Search for files - raopatwari - Jan-16-2018

Thank you