Skip to content

rendering an script creates _files directory not cleared #2595

Open

Description

@fgoerlich

I found the same behaviour as described here when rendering an script.

The 'zip' file provides an example.

xfun::session_info('rmarkdown')
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100), RStudio 2025.5.0.496

Locale:
  LC_COLLATE=Spanish_Spain.utf8  LC_CTYPE=Spanish_Spain.utf8    LC_MONETARY=Spanish_Spain.utf8 LC_NUMERIC=C                  
  LC_TIME=Spanish_Spain.utf8    

Package version:
  base64enc_0.1.3   bslib_0.9.0       cachem_1.1.0      cli_3.6.5         digest_0.6.37     evaluate_1.0.4    fastmap_1.2.0    
  fontawesome_0.5.3 fs_1.6.6          glue_1.8.0        graphics_4.5.1    grDevices_4.5.1   highr_0.11        htmltools_0.5.8.1
  jquerylib_0.1.4   jsonlite_2.0.0    knitr_1.50        lifecycle_1.0.4   memoise_2.0.1     methods_4.5.1     mime_0.13        
  R6_2.6.1          rappdirs_0.3.3    rlang_1.1.6       rmarkdown_2.29.1  sass_0.4.10       stats_4.5.1       tinytex_0.57     
  tools_4.5.1       utils_4.5.1       xfun_0.52         yaml_2.3.10      

Pandoc version: 3.4

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('rmarkdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the rmarkdown package using remotes::install_github("rstudio/rmarkdown") ?

Ejercicio_1.zip

Activity

  1. cderv commented on Jun 19, 2025

    @cderv
    Collaborator

    Thanks for opening. I can't reproduce.

    • I downloaded your zip
    • Unzip and removed .html and _files folder
    • Called rmarkdown::render("Ejercicio_1.R")
    • The output is only .html file and the folder _files is removed
       > fs::dir_tree()
       .
       ├── Barcelona.rda
       ├── Ejercicio_1.html
       ├── Ejercicio_1.R
       └── str2num.R
      

    This is with

    > packageVersion("rmarkdown")
    [1] ‘2.29’
    
  2. added
    reprex
    on Jun 19, 2025
  3. fgoerlich commented on Jun 19, 2025

    @fgoerlich
    Author

    On windows?
    I found the same behaviour with your version, or with the development version.

    > packageVersion("rmarkdown")
    [1] ‘2.29.1’
    
  4. cderv commented on Jun 19, 2025

    @cderv
    Collaborator

    Yes I am on windows

    Here is the reproduction

    dir <- tempfile()
    dir.create(dir)
    owd <- setwd(dir)
    xfun::download_file(
      "https://github.com/user-attachments/files/20798398/Ejercicio_1.zip",
      mode = "wb",
    )
    #> [1] "Ejercicio_1.zip"
    
    unzip("Ejercicio_1.zip")
    list.files()
    #> [1] "Barcelona.rda"     "Ejercicio_1.html"  "Ejercicio_1.R"    
    #> [4] "Ejercicio_1.zip"   "Ejercicio_1_files" "str2num.R"
    unlink("Ejercicio_1.zip")
    unlink("Ejercicio_1.html")
    unlink("Ejercicio_1_files/", recursive = TRUE)
    before <- list.files()
    before
    #> [1] "Barcelona.rda" "Ejercicio_1.R" "str2num.R"
    renv::init()
    #> - Linking packages into the project library ... Done!
    #> - Resolving missing dependencies ... 
    #> # Installing packages --------------------------------------------------------
    #> - Installing prettyunits ...                    OK [linked from cache]
    #> - Installing progress ...                       OK [linked from cache]
    #> - Installing RcppEigen ...                      OK [linked from cache]
    #> The following package(s) will be updated in the lockfile:
    #> 
    #> # CRAN -----------------------------------------------------------------------
    #> - boot             [* -> 1.3-31]
    #> - cluster          [* -> 2.1.8.1]
    #> - codetools        [* -> 0.2-20]
    #> - digest           [* -> 0.6.37]
    #> - evaluate         [* -> 1.0.4]
    #> - glue             [* -> 1.8.0]
    #> - highr            [* -> 0.11]
    #> - jsonlite         [* -> 2.0.0]
    #> - lifecycle        [* -> 1.0.4]
    #> - magrittr         [* -> 2.0.3]
    #> - MASS             [* -> 7.3-65]
    #> - Matrix           [* -> 1.7-3]
    #> - nlme             [* -> 3.1-168]
    #> - nnet             [* -> 7.3-20]
    #> - survival         [* -> 3.8-3]
    #> - vctrs            [* -> 0.6.5]
    #> - withr            [* -> 3.0.2]
    #> - yaml             [* -> 2.3.10]
    #> 
    #> # P3M ------------------------------------------------------------------------
    #> - RcppEigen        [* -> 0.3.4.0.2]
    #> 
    #> # RSPM -----------------------------------------------------------------------
    #> - abind            [* -> 1.4-8]
    #> - askpass          [* -> 1.2.1]
    #> - backports        [* -> 1.5.0]
    #> - base64enc        [* -> 0.1-3]
    #> - bit              [* -> 4.6.0]
    #> - bit64            [* -> 4.6.0-1]
    #> - blob             [* -> 1.2.4]
    #> - broom            [* -> 1.0.8]
    #> - bslib            [* -> 0.9.0]
    #> - ca               [* -> 0.71.1]
    #> - cachem           [* -> 1.1.0]
    #> - callr            [* -> 3.7.6]
    #> - car              [* -> 3.1-3]
    #> - carData          [* -> 3.0-5]
    #> - cellranger       [* -> 1.1.0]
    #> - cli              [* -> 3.6.5]
    #> - clipr            [* -> 0.8.0]
    #> - colorspace       [* -> 2.1-1]
    #> - conflicted       [* -> 1.2.0]
    #> - corrr            [* -> 0.4.4]
    #> - cowplot          [* -> 1.1.3]
    #> - cpp11            [* -> 0.5.2]
    #> - crayon           [* -> 1.5.3]
    #> - curl             [* -> 6.3.0]
    #> - data.table       [* -> 1.17.4]
    #> - DBI              [* -> 1.2.3]
    #> - dbplyr           [* -> 2.5.0]
    #> - Deriv            [* -> 4.1.6]
    #> - doBy             [* -> 4.6.27]
    #> - dplyr            [* -> 1.1.4]
    #> - dtplyr           [* -> 1.3.1]
    #> - fansi            [* -> 1.0.6]
    #> - farver           [* -> 2.1.2]
    #> - fastmap          [* -> 1.2.0]
    #> - fontawesome      [* -> 0.5.3]
    #> - forcats          [* -> 1.0.0]
    #> - foreach          [* -> 1.5.2]
    #> - Formula          [* -> 1.2-5]
    #> - fs               [* -> 1.6.6]
    #> - furrr            [* -> 0.3.1]
    #> - future           [* -> 1.58.0]
    #> - gargle           [* -> 1.5.2]
    #> - gclus            [* -> 1.3.3]
    #> - generics         [* -> 0.1.4]
    #> - ggplot2          [* -> 3.5.2]
    #> - ggrepel          [* -> 0.9.6]
    #> - glmnet           [* -> 4.1-9]
    #> - globals          [* -> 0.18.0]
    #> - googledrive      [* -> 2.1.1]
    #> - googlesheets4    [* -> 1.1.1]
    #> - gtable           [* -> 0.3.6]
    #> - hardhat          [* -> 1.4.1]
    #> - haven            [* -> 2.5.5]
    #> - hms              [* -> 1.1.3]
    #> - htmltools        [* -> 0.5.8.1]
    #> - httr             [* -> 1.4.7]
    #> - ids              [* -> 1.0.1]
    #> - igraph           [* -> 2.1.4]
    #> - isoband          [* -> 0.2.7]
    #> - iterators        [* -> 1.0.14]
    #> - jquerylib        [* -> 0.1.4]
    #> - kknn             [* -> 1.4.1]
    #> - knitr            [* -> 1.50]
    #> - labeling         [* -> 0.4.3]
    #> - lattice          [* -> 0.22-7]
    #> - listenv          [* -> 0.9.1]
    #> - lme4             [* -> 1.1-37]
    #> - lubridate        [* -> 1.9.4]
    #> - MatrixModels     [* -> 0.5-4]
    #> - memoise          [* -> 2.0.1]
    #> - mgcv             [* -> 1.9-3]
    #> - microbenchmark   [* -> 1.5.0]
    #> - mime             [* -> 0.13]
    #> - minqa            [* -> 1.2.8]
    #> - modelr           [* -> 0.1.11]
    #> - nloptr           [* -> 2.2.1]
    #> - numDeriv         [* -> 2016.8-1.1]
    #> - openssl          [* -> 2.3.3]
    #> - parallelly       [* -> 1.45.0]
    #> - pbkrtest         [* -> 0.5.4]
    #> - permute          [* -> 0.9-7]
    #> - pillar           [* -> 1.10.2]
    #> - pkgconfig        [* -> 2.0.3]
    #> - prettyunits      [* -> 1.2.0]
    #> - processx         [* -> 3.8.6]
    #> - progress         [* -> 1.2.3]
    #> - ps               [* -> 1.9.1]
    #> - purrr            [* -> 1.0.4]
    #> - qap              [* -> 0.1-2]
    #> - quantreg         [* -> 6.1]
    #> - R6               [* -> 2.6.1]
    #> - ragg             [* -> 1.4.0]
    #> - rappdirs         [* -> 0.3.3]
    #> - rbibutils        [* -> 2.3]
    #> - RColorBrewer     [* -> 1.1-3]
    #> - Rcpp             [* -> 1.0.14]
    #> - Rdpack           [* -> 2.6.4]
    #> - readr            [* -> 2.1.5]
    #> - readxl           [* -> 1.4.5]
    #> - reformulas       [* -> 0.4.1]
    #> - registry         [* -> 0.5-1]
    #> - rematch          [* -> 2.0.0]
    #> - rematch2         [* -> 2.1.2]
    #> - renv             [* -> 1.1.4]
    #> - reprex           [* -> 2.1.1]
    #> - rlang            [* -> 1.1.6]
    #> - rmarkdown        [* -> 2.29]
    #> - rsample          [* -> 1.3.0]
    #> - rstudioapi       [* -> 0.17.1]
    #> - rvest            [* -> 1.0.4]
    #> - sass             [* -> 0.4.10]
    #> - scales           [* -> 1.4.0]
    #> - selectr          [* -> 0.4-2]
    #> - seriation        [* -> 1.5.7]
    #> - shape            [* -> 1.4.6.1]
    #> - slider           [* -> 0.3.2]
    #> - SparseM          [* -> 1.84-2]
    #> - sparsevctrs      [* -> 0.3.4]
    #> - stringi          [* -> 1.8.7]
    #> - stringr          [* -> 1.5.1]
    #> - sys              [* -> 3.4.3]
    #> - systemfonts      [* -> 1.2.3]
    #> - textshaping      [* -> 1.0.1]
    #> - tibble           [* -> 3.2.1]
    #> - tidyr            [* -> 1.3.1]
    #> - tidyselect       [* -> 1.2.1]
    #> - tidyverse        [* -> 2.0.0]
    #> - timechange       [* -> 0.3.0]
    #> - tinytex          [* -> 0.57]
    #> - TSP              [* -> 1.2-5]
    #> - tzdb             [* -> 0.5.0]
    #> - utf8             [* -> 1.2.5]
    #> - uuid             [* -> 1.2-1]
    #> - vegan            [* -> 2.6-10]
    #> - viridisLite      [* -> 0.4.2]
    #> - vroom            [* -> 1.6.5]
    #> - warp             [* -> 0.2.1]
    #> - xfun             [* -> 0.52]
    #> - xml2             [* -> 1.3.8]
    #> - yardstick        [* -> 1.3.2]
    #> 
    #> The version of R recorded in the lockfile will be updated:
    #> - R                [* -> 4.5.0]
    #> 
    #> - Lockfile written to "C:/Users/chris/AppData/Local/Temp/Rtmp4M7cho/file36386f2b7d3b/renv.lock".
    rmarkdown::render("Ejercicio_1.R")
    #> processing file: Ejercicio_1.spin.Rmd
    #> output file: Ejercicio_1.knit.md
    #> "C:/Users/chris/scoop/shims/pandoc" +RTS -K512m -RTS Ejercicio_1.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output Ejercicio_1.html --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.5\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.5\rmarkdown\rmarkdown\lua\latex-div.lua" --lua-filter "C:\Users\chris\AppData\Local\R\win-library\4.5\rmarkdown\rmarkdown\lua\table-classes.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --template "C:\Users\chris\AppData\Local\R\win-library\4.5\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\chris\AppData\Local\Temp\Rtmp4M7cho\rmarkdown-str3638357473e4.html"
    #> 
    #> Output created: Ejercicio_1.html
    # don't consider the renv files
    after <- setdiff(list.files(), c("renv", "renv.lock"))
    after
    #> [1] "Barcelona.rda"    "Ejercicio_1.html" "Ejercicio_1.R"   
    #> [4] "str2num.R"  
    # new files or folder ?
    setdiff(after, before) 
    #> [1] "Ejercicio_1.html"
    
    setwd(owd)
    unlink(dir, recursive = TRUE)

    As you can, renders works and only diff is the HTML file.

    Session info

    > sessioninfo::session_info()
    ─ Session info ────────────────────────────────────────────────────────
     setting  value
     version  R version 4.5.0 (2025-04-11 ucrt)
     os       Windows 11 x64 (build 26100)
     system   x86_64, mingw32
     ui       Rgui
     language (EN)
     collate  French_France.utf8
     ctype    French_France.utf8
     tz       Europe/Paris
     date     2025-06-19
     pandoc   3.7.0.2 @ C:/Users/chris/scoop/shims/ (via rmarkdown)
     quarto   NA @ C:\\Users\\chris\\scoop\\apps\\quarto\\current\\bin\\quarto.exe
    
    ─ Packages ────────────────────────────────────────────────────────────
     package      * version    date (UTC) lib source
     abind          1.4-8      2024-09-12 [1] RSPM
     askpass        1.2.1      2024-10-04 [1] RSPM
     backports      1.5.0      2024-05-23 [1] CRAN (R 4.5.0)
     broom          1.0.8      2025-03-28 [1] RSPM
     bslib          0.9.0      2025-01-30 [1] RSPM
     ca             0.71.1     2020-01-24 [1] RSPM
     cachem         1.1.0      2024-05-16 [1] RSPM
     callr          3.7.6      2024-03-25 [1] CRAN (R 4.5.0)
     car            3.1-3      2024-09-27 [1] RSPM
     carData        3.0-5      2022-01-06 [1] RSPM
     cli            3.6.5      2025-04-23 [1] CRAN (R 4.5.0)
     clipr          0.8.0      2022-02-22 [1] RSPM
     codetools      0.2-20     2024-03-31 [2] CRAN (R 4.5.0)
     corrr          0.4.4      2022-08-16 [1] RSPM
     crayon         1.5.3      2024-06-20 [1] RSPM
     credentials    2.0.2      2024-10-04 [1] RSPM
     curl           6.3.0      2025-06-06 [1] RSPM
     digest         0.6.37     2024-08-19 [1] CRAN (R 4.5.0)
     dplyr        * 1.1.4      2023-11-17 [1] RSPM
     evaluate       1.0.4      2025-06-18 [1] CRAN (R 4.5.0)
     farver         2.1.2      2024-05-13 [1] RSPM
     fastmap        1.2.0      2024-05-15 [1] RSPM
     forcats      * 1.0.0      2023-01-29 [1] RSPM
     foreach        1.5.2      2022-02-02 [1] RSPM
     Formula        1.2-5      2023-02-24 [1] RSPM
     fs             1.6.6      2025-04-12 [1] CRAN (R 4.5.0)
     furrr          0.3.1      2022-08-15 [1] RSPM
     future         1.58.0     2025-06-05 [1] RSPM
     generics       0.1.4      2025-05-09 [1] RSPM
     ggplot2      * 3.5.2      2025-04-09 [1] RSPM
     glmnet       * 4.1-9      2025-06-02 [1] RSPM
     globals        0.18.0     2025-05-08 [1] RSPM
     glue           1.8.0      2024-09-30 [1] CRAN (R 4.5.0)
     gtable         0.3.6      2024-10-25 [1] RSPM
     hms            1.1.3      2023-03-21 [1] RSPM
     htmltools      0.5.8.1    2024-04-04 [1] RSPM
     igraph         2.1.4      2025-01-23 [1] RSPM
     iterators      1.0.14     2022-02-05 [1] RSPM
     jquerylib      0.1.4      2021-04-26 [1] RSPM
     jsonlite       2.0.0      2025-03-27 [1] CRAN (R 4.5.0)
     kknn         * 1.4.1      2025-05-19 [1] RSPM
     knitr          1.50       2025-03-16 [1] RSPM
     labeling       0.4.3      2023-08-29 [1] RSPM
     lattice        0.22-7     2025-04-02 [1] RSPM
     lifecycle      1.0.4      2023-11-07 [1] CRAN (R 4.5.0)
     listenv        0.9.1      2024-01-29 [1] RSPM
     lubridate    * 1.9.4      2024-12-08 [1] RSPM
     magrittr       2.0.3      2022-03-30 [1] CRAN (R 4.5.0)
     Matrix       * 1.7-3      2025-03-11 [2] CRAN (R 4.5.0)
     openssl        2.3.3      2025-05-26 [1] RSPM
     pak            0.8.0.2    2025-04-24 [1] local
     parallelly     1.45.0     2025-06-02 [1] RSPM
     pillar         1.10.2     2025-04-05 [1] RSPM
     pkgconfig      2.0.3      2019-09-22 [1] RSPM
     pkgload        1.4.0      2024-06-28 [1] CRAN (R 4.5.0)
     processx       3.8.6      2025-02-21 [1] CRAN (R 4.5.0)
     ps             1.9.1      2025-04-12 [1] CRAN (R 4.5.0)
     purrr        * 1.0.4      2025-02-05 [1] CRAN (R 4.5.0)
     R6             2.6.1      2025-02-15 [1] CRAN (R 4.5.0)
     RColorBrewer   1.1-3      2022-04-03 [1] RSPM
     Rcpp           1.0.14     2025-01-12 [1] RSPM
     readr        * 2.1.5      2024-01-10 [1] RSPM
     registry       0.5-1      2019-03-05 [1] RSPM
     renv           1.1.4      2025-03-20 [1] RSPM
     reprex         2.1.1      2024-07-06 [1] RSPM
     rlang          1.1.6      2025-04-11 [1] CRAN (R 4.5.0)
     rmarkdown      2.29       2024-11-04 [1] RSPM
     rsample        1.3.0      2025-04-02 [1] RSPM
     rstudioapi     0.17.1     2024-10-22 [1] RSPM
     sass           0.4.10     2025-04-11 [1] RSPM
     scales         1.4.0      2025-04-24 [1] RSPM
     seriation      1.5.7      2024-12-05 [1] RSPM
     sessioninfo    1.2.3.9000 2025-06-02 [1] Github (r-lib/sessioninfo@5d07442)
     shape          1.4.6.1    2024-02-23 [1] RSPM
     stringi        1.8.7      2025-03-27 [1] CRAN (R 4.5.0)
     stringr      * 1.5.1      2023-11-14 [1] CRAN (R 4.5.0)
     survival       3.8-3      2024-12-17 [2] CRAN (R 4.5.0)
     sys            3.4.3      2024-10-04 [1] RSPM
     tibble       * 3.2.1      2023-03-20 [1] RSPM
     tidyr        * 1.3.1      2024-01-24 [1] RSPM
     tidyselect     1.2.1      2024-03-11 [1] RSPM
     tidyverse    * 2.0.0      2023-02-22 [1] RSPM
     timechange     0.3.0      2024-01-18 [1] RSPM
     TSP            1.2-5      2025-05-27 [1] RSPM
     tzdb           0.5.0      2025-03-15 [1] RSPM
     utf8           1.2.5      2025-05-01 [1] RSPM
     vctrs          0.6.5      2023-12-01 [1] CRAN (R 4.5.0)
     withr          3.0.2      2024-10-28 [1] CRAN (R 4.5.0)
     xfun           0.52       2025-04-02 [1] CRAN (R 4.5.0)
     yaml           2.3.10     2024-07-26 [1] CRAN (R 4.5.0)
     yardstick      1.3.2      2025-01-22 [1] RSPM
    
     [1] C:/Users/chris/AppData/Local/R/win-library/4.5
     [2] C:/Program Files/R/R-4.5.0/library
     * ── Packages attached to the search path.
    
    ───────────────────────────────────────────────────────────────────────

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    reprex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions