Export a file from RStudio posit WD to local WD WITH CODE

Hey guys!

I need to know if it is possible to export a file from the WD of Rstudio in the posit workbench environment to the local directory of my machine with code. This may be possible because it does exists the option with buttons (selecting the file from Rstudio WD -> More -> Export), but I need exactly the same process being executed from code!

Thank you all!