Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats.ctime cannot be used to retrieve the creation time #10

Closed
KasparEtter opened this issue Mar 12, 2020 · 3 comments
Closed

stats.ctime cannot be used to retrieve the creation time #10

KasparEtter opened this issue Mar 12, 2020 · 3 comments

Comments

@KasparEtter
Copy link
Contributor

First of all: This is a really awesome tool and exactly what I was looking for! 馃槏

case 'cr':
case 'create':
case 'cr[eate]': {
printIfVerbose(fileObj, 'Formatting ' + fileObj.base + ' create date to: ' + format);
let stats = fs.statSync(fileObj.dir + '/' + fileObj.base);
if (stats.ctime) returnText = dateFormat(stats.ctime, format);
break;
}

ctime:

ctime stands for status change time. This timestamp tells you when was the last time the property and metadata of the file were changed. The metadata includes file permissions, ownership, name and location of the file.

Please use stats.birthtime for this (see this documentation for platform availability).

In other words, with {{date|create}} you get when the file content or its name was last changed. Until this is fixed, I will just use {{date|modify}} instead, which at least ignores file renames.

@jhotmann
Copy link
Owner

Glad you like the tool! I am going to make this change. If you run into things like this continue to submit issues but in the meantime you can also override the default behavior with the replacements.js file that is installed to ~/.rename/replacements.js or %UserProfile%\.rename\.replacements.js on Windows. Just copy the entire date object and replace ctime with birthtime.

@jhotmann
Copy link
Owner

Fixed in 6.1.0

@KasparEtter
Copy link
Contributor Author

Awesome, thanks a lot for addressing all these issues/suggestions! 鉂わ笍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants