Stata 15 help for copy

[D] copy -- Copy file from disk or URL


copy filename1 filename2 [, options]

filename1 may be a filename or a URL. filename2 may be the name of a file or a directory. If filename2 is a directory name, filename1 will be copied to that directory. filename2 may not be a URL.

Note: Double quotes may be used to enclose the filenames, and the quotes must be used if the filename contains embedded blanks.

options Description ------------------------------------------------------------------------- public make filename2 readable by all text interpret filename1 as text file and translate to native text format

replace may overwrite filename2 ------------------------------------------------------------------------- replace does not appear in the dialog box.


copy copies an existing file to a file with a new name.


public specifies that filename2 be readable by everyone; otherwise, the file will be created according to the default permissions of your operating system.

text specifies that filename1 be interpreted as a text file and be translated to the native form of text files on your computer. Computers differ on how end-of-line is recorded: Unix systems record one line-feed character, Windows computers record a carriage-return/line-feed combination, and Mac computers record just a carriage return. text specifies that filename1 be examined to determine how it has end-of-line recorded and that the line-end characters be switched to whatever is appropriate for your computer when the copy is made.

There is no reason to specify text when copying a file already on your computer to a different location because the file would already be in your computer's format.

Do not specify text unless you know that the file is a text file; if the file is binary and you specify text, the copy will be useless. Most word processors produce binary files, not text files. The term text, as it is used here, specifies a particular way of recording textual information.

When other parts of Stata read text files, they do not care how lines are terminated, so there is no reason to translate end-of-line characters on that score. You specify text because you may want to look at the file with other software.

The following option is available with copy but is not shown in the dialog box:

replace specifies that filename2 be replaced if it already exists.


Windows: . copy orig.dta newcopy.dta . copy mydir\orig.dta . . copy orig.dta ../../ . copy "my document" "copy of document" . copy ..\mydir\doc.txt document\doc.tex . copy simple.dta . copy simple.txt, text

Mac: . copy orig.dta newcopy.dta . copy mydir/orig.dta . . copy orig.dta ../../ . copy "my document" "copy of document" . copy ../mydir/doc.txt document/doc.tex . copy simple.dta . copy simple.txt, text

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index