Questions tagged [copy]

To copy is to create a duplicate of an object without destroying the original. Commonly seen in text editors that will let you copy some text and paste it somewhere else.

In computing, copy is related both to the command by which a duplicate of a specified entity is made, both in terms of its definition and content, as well as the resulting duplicate itself.

In terms of abstracted use, 'copy' such as when performing a cut-copy-paste operation via a graphical user interface, is an interface metaphor based on the physical procedure used in manuscript editing to create a page layout.

11278 questions
226
votes
2 answers

Understanding exactly when a data.table is a reference to (vs a copy of) another data.table

I'm having a little trouble understanding the pass-by-reference properties of data.table. Some operations seem to 'break' the reference, and I'd like to understand exactly what's happening. On creating a data.table from another data.table (via <-,…
Peter Fine
  • 2,873
  • 3
  • 14
  • 16
216
votes
4 answers

How to copy in bash all directory and files recursive?

I have script: find ./SourceFolder/ -maxdepth 4 -exec cp -R '{}' ./DestFolder/ \; SourceDir contains also sub-folders. Problem that in DestFolder not only all tree, but in up level all another levels and files. How to fix ?
user710818
  • 23,228
  • 58
  • 149
  • 207
214
votes
2 answers

Copy text to clipboard with iOS

What is the best way to copy text to the iPhone's clipboard in your application? Their docs are sketchy and have way more features than what I want... I just want to set a string as the users clipboard.
tarnfeld
  • 25,992
  • 41
  • 111
  • 146
205
votes
9 answers

How do I create a copy of an object in PHP?

It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: b = "after";…
Nick Stinemates
  • 41,511
  • 21
  • 59
  • 60
196
votes
5 answers

Find and copy files

Why does the following does not copy the files to the destination folder? # find /home/shantanu/processed/ -name '*2011*.xml' -exec cp /home/shantanu/tosend {} \; cp: omitting directory `/home/shantanu/tosend' cp: omitting directory…
shantanuo
  • 31,689
  • 78
  • 245
  • 403
193
votes
26 answers

In MySQL, can I copy one row to insert into the same table?

insert into table select * from table where primarykey=1 I just want to copy one row to insert into the same table (i.e., I want to duplicate an existing row in the table) but I want to do this without having to list all the columns after the…
lina
  • 1,931
  • 2
  • 12
  • 4
183
votes
13 answers

How to copy data from one table to another new table in MySQL?

I want to copy data from one table to another in MySQL. Table 1 (Existing table): aid st_id from_uid to_gid to_uid created changed subject message link Table 2 (New Table) st_id uid changed status assign_status I want to copy some fields of…
Fero
  • 12,969
  • 46
  • 116
  • 157
182
votes
34 answers

Copying files from one directory to another in Java

I want to copy files from one directory to another (subdirectory) using Java. I have a directory, dir, with text files. I iterate over the first 20 files in dir, and want to copy them to another directory in the dir directory, which I have created…
user42155
  • 48,965
  • 27
  • 59
  • 60
182
votes
3 answers

Record file copy operation with Git

When I move a file in git using git-mv the status shows that the file has been renamed and even if I alter some portions it still considers to be almost the same thing (which is good because it lets me follow the history of it). When I copy a file…
Hexdoll
  • 2,006
  • 2
  • 15
  • 9
179
votes
2 answers

Secret copy to clipboard JavaScript function in Chrome and Firefox?

Update Looks like browsers are starting to support copy natively in JS In the console windows of both Chrome and Firefox on Mac I can execute copy("party in your clipboard!"); and the text gets copied to my clipboard. I have searched SO and Google…
Mike Grace
  • 16,636
  • 8
  • 59
  • 79
178
votes
10 answers

How to copy a file from one directory to another using PHP?

Say I've got a file test.php in foo directory as well as bar. How can I replace bar/test.php with foo/test.php using PHP? I'm on Windows XP, a cross platform solution would be great but windows preferred.
Ali
  • 261,656
  • 265
  • 575
  • 769
177
votes
14 answers

How to copy a java.util.List into another java.util.List

I have a List that is populated from a Web Service. I want to copy/clone the contents of that list into an empty list of the same type. A Google search for copying a list suggested me to use Collections.copy() method. In all the examples I…
Mono Jamoon
  • 4,437
  • 17
  • 42
  • 64
175
votes
4 answers

Copying files to a container with Docker Compose

I have a Dockerfile where I copy an existing directory (with content) to the container which works fine: Dockerfile FROM php:7.0-apache COPY Frontend/ /var/www/html/aw3somevideo/ COPY Frontend/ /var/www/html/ RUN ls -al /var/www/html RUN chown -R…
TheDoctor
  • 2,362
  • 4
  • 22
  • 39
175
votes
9 answers

How to copy file from HDFS to the local file system

How to copy file from HDFS to the local file system . There is no physical location of a file under the file , not even directory . how can i moved them to my local for further validations.i am tried through winscp .
Surya
  • 3,408
  • 5
  • 27
  • 35
170
votes
5 answers

Batch file to copy directories recursively

Is there a way to copy directories recursively inside a .bat file? Is an example of this available?
sarsnake
  • 26,667
  • 58
  • 180
  • 286