Much like this question, I am trying to import data from csv files based on date of creation.
I am running Linux Mint and have a bash script that creates csv files every day with file name of the following format: "MonthFullName-dd-yyyy"
. When I use the code snippet in the above question's answer as":
dateOrdered = ((names =
FileNames["/home/folder_name/*.csv"])[[Ordering[
FileDate[#, "Modification"] & /@ names
It returns:
"/home/folder_name/February-01-2018.csv", \
"/home/folder_name/February-02-2018.csv", \
"/home/folder_name/February-03-2018.csv", \
"/home/folder_name/February-05-2018.csv", \
"/home/folder_name/February-06-2018.csv", \
"/home/folder_name/February-07-2018.csv", \
"/home/folder_name/February-08-2018.csv", \
"/home/folder_name/February-12-2018.csv", \
"/home/folder_name/February-13-2018.csv", \
"/home/folder_name/February-14-2018.csv", \
"/home/folder_name/February-15-2018.csv", \
"/home/folder_name/January-11-2018.csv", \
"/home/folder_name/January-19-2018.csv", \
"/home/folder_name/January-22-2018.csv", \
"/home/folder_name/January-23-2018.csv", \
"/home/folder_name/January-24-2018.csv", \
"/home/folder_name/January-25-2018.csv", \
"/home/folder_name/January-26-2018.csv", \
"/home/folder_name/January-29-2018.csv", \
"/home/folder_name/January-30-2018.csv", \
"/home/folder_name/January-31-2018.csv"
This is NOT the order in which these files were created. It would seem that further ordering by file name has taken place.
I do not have the option "Creation"
instead of "Modification"
since I am returned the error: The Creation date of a file is not available on Macintosh and Unix
.
How do I order my list by the date of creation without ordering by file name also?
Edit: I just realized that Unix does not have the concept of "creation time". So in my case, what is the best way to sort by files given their obvious file names of "Month-dd-yyyy.csv"?
FileDate[#, "Modification"] & /@ names
$\endgroup$FileDate[#, "Creation"] &
... (I know that it does not help you, though.) $\endgroup$