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 multiple CSV files for a string or strings cubangt 7 7,838 Feb-23-2022, 12:53 AM
Last Post: Pedroski55
  Search string in mutliple .gz files SARAOOF 10 6,773 Aug-26-2021, 01:47 PM
Last Post: SARAOOF
  how search files Ron_Crafter 4 42,035 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 1,759 Dec-09-2020, 05:14 PM
Last Post: sutra
  Complex word search multiple files Kristenl2784 0 1,555 Jul-18-2020, 01:22 PM
Last Post: Kristenl2784
  Search for files and copy them to different location jayser247 4 2,419 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