I have a great use case using R and RStudio with a Google Drive folder, but I need to be able to have "file.info()" function in R *see* the file times, and it gets nothing.
Is that a Google Drive problem or an R file.info() problem?
Here is the file.info() information from Google Drive files and native Windows file system files below: (Google Drive first, times NA)
> str(PathDetails)[]
'data.frame': 17 obs. of 7 variables:
$ size : num NA NA NA NA NA NA NA NA NA NA ...
$ isdir: logi NA NA NA NA NA NA ...
$ mode : 'octmode' int NA NA NA NA NA NA NA NA NA NA ...
$ mtime: POSIXct, format: NA NA NA NA ...
$ ctime: POSIXct, format: NA NA NA NA ...
$ atime: POSIXct, format: NA NA NA NA ...
$ exe : chr NA NA NA NA ...
NULL
> summary(PathDetails)
size isdir mode mtime ctime atime exe
Min. : NA Mode:logical Min. : NA Min. :NA Min. :NA Min. :NA Length:17
1st Qu.: NA NA's:17 1st Qu.: NA 1st Qu.:NA 1st Qu.:NA 1st Qu.:NA Class :character
Median : NA Median : NA Median :NA Median :NA Median :NA Mode :character
Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA 3rd Qu.:NA 3rd Qu.:NA 3rd Qu.:NA
Max. : NA Max. : NA Max. :NA Max. :NA Max. :NA
NA's :17 NA's :17 NA's :17 NA's :17 NA's :17
>
file.info() for native Windows file system folders next: (times present)
[1] "HospitalsbyZip.R" "HospitalsbyZip.Rproj"
> DataFilePath <- getwd()
> PathDetails = file.info( list.files( DataFilePath))
> PathDetails = PathDetails[ with(PathDetails, order(as.POSIXct(ctime))), ]
> FileList = rownames( PathDetails )
> nfiles = length(FileList)
> str(PathDetails)
'data.frame': 2 obs. of 7 variables:
$ size : num 218 162
$ isdir: logi FALSE FALSE
$ mode : 'octmode' int 666 666
$ mtime: POSIXct, format: "2022-07-28 16:09:51" "2022-07-28 16:15:25"
$ ctime: POSIXct, format: "2022-07-28 16:09:49" "2022-07-28 16:15:25"
$ atime: POSIXct, format: "2022-07-28 16:09:51" "2022-07-28 16:15:32"
$ exe : chr "no" "no"
An initial response is:
Please post your question as a new topic and continue the conversation there since it is off topic on this thread. The file times for Google Drive for Desktop files are available using standard Windows API calls (for example they show up correctly in File Explorer and via the DIR command in a command prompt), so I would suggest the problem is with R.
I will try to post a link to this discussion in a relevant R discussion group.
SOLVED.
My problem was a problem is with a call like this in R and returning a relative versus a full pathname in a function:
PathDetails = file.info( list.files( DataFilePath, pattern = DataFilePattern,
full.names = T ))
I was not using the full.names option in list.files() and was returning a relative filename when I needed a full pathname in file.info.