How to check latest change time of each file using glob in python

0 votes
I have a python script that does certain operations on files. For a function, I need to check the last changing time of a file. I was suggested to use glob to do this but I am not able to figure out how to implement it. Please help
Jan 2, 2019 in Python by slayer
• 29,370 points
1,821 views

1 answer to this question.

0 votes

You can get the changing time from the getctime property

import glob
import os 
list_of_files = glob.glob('/path/to/folder/*') # * means all if need specific format then *.csv
last_change_time = os.path.getctime
answered Jan 2, 2019 by Omkar
• 69,220 points

Related Questions In Python

+1 vote
1 answer

How to check if a string is in a file, using python?

Hi, Try the below given code: with open('myfile.txt') as ...READ MORE

answered Jul 5, 2019 in Python by Shabnam
• 930 points
2,244 views
0 votes
1 answer

How to get the latest file in a folder using python?

Hello @kartik,  would suggest using glob.iglob() instead of the glob.glob(), as ...READ MORE

answered May 27, 2020 in Python by Niroj
• 82,840 points
11,845 views
+1 vote
2 answers

How to print first character of each word in upper case of a string in Python

text = "this is a sample python ...READ MORE

answered Jun 22, 2022 in Python by anonymous

edited Mar 5 12,659 views
0 votes
4 answers

How to print objects of class using print function in Python?

You have to called the built in ...READ MORE

answered May 12, 2021 in Python by anonymous

edited Mar 5 78,882 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,649 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,420 views
+1 vote
1 answer

How to read hdfs file using python?

subprocess.Popen(["hadoop", "fs", "-cat", "/path/to/myfile"], stdou ...READ MORE

answered Dec 7, 2018 in Python by Omkar
• 69,220 points
5,700 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP