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,300 points
224 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,030 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 4, 2019 in Python by Shabnam
• 930 points
302 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 in Python by Niroj
• 78,120 points
2,253 views
+1 vote
2 answers

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

class Solution:     def firstAlphabet(self, s):             self.s=s              k=''              k=k+s[0]              for i in range(len(s)):                     if ...READ MORE

answered Oct 28 in Python by Anurag
5,854 views
0 votes
1 answer

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

It can be done as shown below: class Element: ...READ MORE

answered Dec 3, 2018 in Python by Nymeria
• 3,520 points

edited Dec 19, 2018 by Nymeria 35,219 views
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 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,800 points
1,185 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 6, 2018 in Python by Omkar
• 69,030 points
3,875 views