Is there a way to get the most recent directory by date in JavaScript? Or if this not possible, the directory with the highest number?
Because I have a folder with versions, and I want to use JavaScript to select the latest version and redirect to that folder.
To be more clear, I want this because GitHub pages only supports HTML, CSS and JS.
folder/
1.0/
index.html
2.0/
index.html
3.0/
index.html
index.html
Thank you in advance!
If you are using nodejs, you can use fs.stat(path, [callback])
which will give you mtime
as part of the stats object in the callback
mtime
is the time at which the file/folder was last modified.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.