[Rd] dir.exists returns FALSE on Symlink directory
Serguei Sokol
@oko| @end|ng |rom |n@@-tou|ou@e@|r
Mon Jun 26 17:30:15 CEST 2023
Le 26/06/2023 à 17:17, Serguei Sokol a écrit :
> Le 26/06/2023 à 16:26, Dipterix Wang a écrit :
>> I hope I'm not asking a stupid question...
> Many think that there is no such thing as "stupid question". However,
> this one looks more appropriate for r-help list, does not it?
>
>> If I symlink a directory, is symlink considered as directory in R?
>> If so, why `dir.exists` returns FALSE on directory?
>>
>> I understand symlink is essentially a file, but functionally a
>> symlink to directory is no different to the directory itself, but a
>> directory is also essentially a file.
>>
>> Is there any way that allow me to check if a symlink is linked to
>> directory in base R, like `dir.exists(..., symlink_ok = TRUE)`?
> What about :
>
> dir.exists(Sys.readlink("your_link"))
Or even better:
file_test("-d", "your_real_dir_or_simlink_to_dir")
which returns TRUE for both a real dir and a simlink to a dir.
Best,
Serguei.
>
> ?
>
> Best,
> Serguei.
>
>>
>> Thanks,
>> Dipterix
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
--
Serguei Sokol
Ingenieur de recherche INRAE
Cellule Mathématiques
TBI, INSA/INRAE UMR 792, INSA/CNRS UMR 5504
135 Avenue de Rangueil
31077 Toulouse Cedex 04
tel: +33 5 61 55 98 49
email: sokol using insa-toulouse.fr
https://www.toulouse-biotechnology-institute.fr/en/plateformes-plateaux/cellule-mathematiques/
More information about the R-devel
mailing list