On 17/10/2012 13:59, Berend Hasselman wrote:

On 17-10-2012, at 13:53, Rui Barradas wrote:

Hello,

On Windows this should be the old DOS command RENAME (or REN) and apparently 
the R function ?file.rename carries it's name.


If I'm reading the help for file.rename correctly it can't move a file from one directory 
to another on Windows ("On Windows,file.rename nowadays works across volumes for 
files but not directories.". If I remember correctly one will have to use system() 
and the command move.

You are not.

On Windows, file.rename() can move a normal file from one directory to another, even to a directory on another volume.

What it cannot do is move a directory from a directory on one file system (volume in Windows' parlance) to a directory on another.

Basically no program can really move files between file systems, but some OSes have an atomic copy-and-delete operation and others (including recent versions of Windows) emulate the move by copying and then deleting, but not recursively and so only for normal files.

It is hard to write precise documentation where on a POSIX file system a directory is a file and on a Windows file system it is not. And you can have either type of file system on either a POSIX OS or Windows.


Assuming that the OP wants to move files from within R (with cut and paste of 
course)

Berend


And yes, the question is terrible. It also shows poor use of the help system. I 
didn't know the function name but got it right at the second try:

?file   # no, other stuff
?file.copy  # yes

Hope this helps,

Rui Barradas
Em 17-10-2012 12:27, R. Michael Weylandt escreveu:
On Wed, Oct 17, 2012 at 12:11 PM, Berend Hasselman <[email protected]> wrote:
On 17-10-2012, at 10:49, Rantony wrote:

Hi ,A simple question, How we can move a file from one location to another ?
(i mean cut & paste)Can any one help fast please ?Thanks in advance- Antony

What does this have to with R?
Will depend on the system you are using.
Look in the help of your file manager.

Berend
As I have said to "Rantony" multiple times before: this is an OS
operation so you'll likely need to use the system() function to give
your OS the command.

The exact form of the command given depends on your (unstated!) OS but
on Unices its usually some variant on

mv A B

However, I also know that Rantony is on Windows so he'll need a
different command.

To Rantony: please try to improve the quality of your questions. I've
explained multiple times what we look for in a question on this list
and you've really shown very little attempt to improve. At the end of
the day, we are all just volunteers here, so help us help you. You
might even learn something in the process. And please _please_ quote
context if you must post from Nabble.

Michael

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,                  [email protected]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to