I want to copy/paste a file from one folder to another folder in windows using R, but it's not working. My code:
> file.rename(from="C:/Users/msc2/Desktop/rabata.txt",to="C:/Users/msc2/Desktop/Halwa/BADMASHI/SCOP/rabata.tx") [1] FALSE
Click on the Drop stack tab to open it. Now we can drag and drop each file we want to copy into the drop stack area. Once we have all the files we want to copy in the drop stack area, we can open the folder we want to copy to, and simply drag and drop all the files from the drop stack to that folder.
The files tool allows you to move files between folders so you can stay organized.
To move a file, hold down the Shift key while dragging. You can also use the middle mouse button to drag files. In this case, gThumb will ask you if you wish to copy the files, move the files, or cancel the operation. Select the files to be transferred, right-click on the selection, and choose Copy to... or Move to....
If you wanted a file.rename()
-like function that would also create any directories needed to carry out the rename, you could try something like this:
my.file.rename <- function(from, to) { todir <- dirname(to) if (!isTRUE(file.info(todir)$isdir)) dir.create(todir, recursive=TRUE) file.rename(from = from, to = to) } my.file.rename(from = "C:/Users/msc2/Desktop/rabata.txt", to = "C:/Users/msc2/Desktop/Halwa/BADMASHI/SCOP/rabata.txt")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With