0

I have a script in node.js which find all files in specific directory, and takes it modified time:

 fs.stat(path, function(err, states){
                console.log(states.mtime)
 })

and it prints me the following:

Sun Aug 31 2014 11:40:14 GMT-0400 (EDT)

I want to print only files which was modified before 6 hours from now.

Is this Data object support it?

1 Answer 1

1
fs.stat(path, function(err, states){
    if (state.mtime < new Date() - (6*60*60*1000)) {
        console.log(states.mtime)
    }
 })

Only print if the date is less than the current date - 6 hours.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.