Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search for files
#1
I need to find files in dir path which are greater than zero bytes and print them
Reply
#2
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.
Reply
#3
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)
Reply
#4
You need to pass the dir_path argument to is_non_zero_file
file_list = is_non_zero_file(dir_path)
Reply
#5
Thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Search string in mutliple .gz files SARAOOF 10 1,773 Aug-26-2021, 01:47 PM
Last Post: SARAOOF
  how search files Ron_Crafter 4 1,088 Apr-17-2021, 11:19 AM
Last Post: Ron_Crafter
  Merging all file_name.log's files from directory to one and search “PerformanceINFO" sutra 0 662 Dec-09-2020, 05:14 PM
Last Post: sutra
  Complex word search multiple files Kristenl2784 0 782 Jul-18-2020, 01:22 PM
Last Post: Kristenl2784
  Search for files and copy them to different location jayser247 4 1,193 Apr-25-2020, 12:50 AM
Last Post: jayser247

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020