Custom function not working within shiny app

Hi all! I wrote an app that among other things should read a bunch of files and move them from the directory where they lived into an archive directory. The app runs on a Linux based R server. I wrote the function to move the files and placed it within a sourced helpers.R file. The function looks like this:

move_function <- function(x) {
  fs::file_move(paste("/path/to/PAP_Ankündigungen", x, sep = "/"),
            paste("/path/to/PAP_Ankündigungsarchiv", x, sep = "/"))

And here is an MRE of the app:




# Define UI for application 
ui <- fluidPage(

            actionButton("move", "Move")


# Define server logic
server <- function(input, output) {
  observeEvent(input$move, {
    filelist <- list.files("/path/to/PAP_Ankündigungen")
    lapply(filelist, move_function)

# Run the application 
shinyApp(ui = ui, server = server)

If I run the function outside of Shiny, the files move without problems, but I can't for the life of me understand what I am doing wrong within Shiny...

If anyone has an idea, I would be very thankful!


This topic was automatically closed 54 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.