Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving files between folders

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 
like image 737
Sagar Nikam Avatar asked Apr 22 '12 09:04

Sagar Nikam


People also ask

Is there a way to move files from multiple folders at once?

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.

Which tool is appropriate to use to move files between folders?

The files tool allows you to move files between folders so you can stay organized.

How do I move files without copying?

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....


1 Answers

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") 
like image 54
Josh O'Brien Avatar answered Sep 19 '22 15:09

Josh O'Brien