[ENOTDIR] Failed to search directory

Hello everybody
I'm having a problem with R where I can't understand the source of the error.
I'm struggling to create a completely reproducible example, but here's the traceback and the the part of the program that I believe may be the error respectively.

#Traceback
Error: [ENOTDIR] Failed to search directory 'inputs/ips_reg_jul21_jul22.xlsx': not a directory
5.
(function (..., call. = TRUE, domain = NULL)
{
if (...length() == 1L && inherits(..1, "condition")) {
cond <- ..1 ...
4.
dir_map(old, identity, all, recurse, type, fail)
3.
dir_ls(old, type = "directory", recurse = TRUE, all = TRUE)
2.
fs::dir_delete(fs::dir_ls("inputs/")) at 1_trends.R#17
1.
gtrends_ips(color = "#804494", map_color = "RdPu", ano_mes, ano_mes_52)

Code

data_month <- fs::dir_ls("inputs/", regexp = "xlsx") |>
stringr::str_sub(start = -10,end = -6) |>
unique()

actual_month <- lubridate::today() |>
zoo::as.yearmon() |>
stringr::str_remove("\s20")

if (data_month != actual_month) {
fs::dir_ls("inputs/", regexp = "xlsx") |>
fs::dir_delete()

... and the code goes on.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.