-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
Some types of folders have extensions, such as geodatabases (.gdb). Some {fs} functions, such as is_dir() even recognizes these are folders. However, some other functions seem to trip up... When trying to rename a geodatabase folder, file_move() seems to assume that the path argument is a file and that new_path is a folder where we want to place it. This routine fails with fs::file_move() but work fine with base::file_rename().
library(fs)
# Create a geodatabase folder
dir_create("My_Geodatabase.gdb")
# Sanity check
is_dir("My_Geodatabase.gdb")
#> My_Geodatabase.gdb
#> TRUE
# Attempt to rename it using {fs}
file_move(
path = "My_Geodatabase.gdb",
new_path = "my_geodatabase.gdb"
)
#> Error: [EINVAL] Failed to move 'My_Geodatabase.gdb' to 'my_geodatabase.gdb/My_Geodatabase.gdb': invalid argument
# Attempt to rename it using {base}
file.rename(
from = "My_Geodatabase.gdb",
to = "my_geodatabase.gdb"
)
#> [1] TRUECreated on 2025-07-24 with reprex v2.1.1
Session info
sessionInfo()
#> R version 4.5.0 (2025-04-11 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 22631)
#>
#> Matrix products: default
#> LAPACK version 3.12.1
#>
#> locale:
#> [1] LC_COLLATE=English_Canada.utf8 LC_CTYPE=English_Canada.utf8
#> [3] LC_MONETARY=English_Canada.utf8 LC_NUMERIC=C
#> [5] LC_TIME=English_Canada.utf8
#>
#> time zone: America/Toronto
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] fs_1.6.6
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.37 fastmap_1.2.0 xfun_0.52 magrittr_2.0.3
#> [5] glue_1.8.0 tibble_3.3.0 knitr_1.50 pkgconfig_2.0.3
#> [9] htmltools_0.5.8.1 rmarkdown_2.29 lifecycle_1.0.4 cli_3.6.5
#> [13] vctrs_0.6.5 reprex_2.1.1 withr_3.0.2 compiler_4.5.0
#> [17] rstudioapi_0.17.1 tools_4.5.0 pillar_1.10.2 evaluate_1.0.3
#> [21] yaml_2.3.10 rlang_1.1.6Metadata
Metadata
Assignees
Labels
No labels