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
130
votes
13 answers

Is there a function to copy an array in C/C++?

I know that Java has a function System.arraycopy(); to copy an array. I was wondering if there is a function in C or C++ to copy an array. I was only able to find implementations to copy an array by using for loops, pointers, etc. But is there a…
J L
  • 2,157
  • 3
  • 16
  • 15
129
votes
3 answers

Using FileSystemWatcher to monitor a directory

I am using a Windows Forms Application to monitor a directory and move the files dropped in it to another directory. At the moment it will copy the file to another directory, but when another file is added it will just end with no error message.…
deepseapanda
  • 3,717
  • 8
  • 32
  • 39
128
votes
8 answers

Copying text with color from Notepad++

Is there a way to copy the text from a Notepad ++ file with color? I am trying to write a tutorial document, and I would to be able to copy the xml tags. Thanks!
user620189
  • 2,595
  • 7
  • 21
  • 19
126
votes
8 answers

Copy multiple files in Python

How to copy all the files present in one directory to another directory using Python. I have the source path and the destination path as string.
hidayat
  • 9,493
  • 13
  • 51
  • 66
123
votes
5 answers

How do I make a exact duplicate copy of an array?

How would I make an exact duplicate of an array? I am having hard time finding information about duplicating an array in Swift. I tried using .copy() var originalArray = [1, 2, 3, 4] var duplicateArray = originalArray.copy()
Patrick
  • 1,231
  • 2
  • 8
  • 3
121
votes
13 answers

Modifying a copy of a JavaScript object is causing the original object to change

I am copying objA to objB const objA = { prop: 1 }, const objB = objA; objB.prop = 2; console.log(objA.prop); // logs 2 instead of 1 same problem for Arrays const arrA = [1, 2, 3], const arrB = arrA; arrB.push(4); console.log(arrA.length); //…
Vallabha
  • 1,591
  • 3
  • 13
  • 21
121
votes
8 answers

Copy constructor in python?

Is there a copy constructor in python ? If not what would I do to achieve something similar ? The situation is that I am using a library and I have extended one of the classes there with extra functionality and I want to be able to convert the…
Zitrax
  • 19,036
  • 20
  • 88
  • 110
118
votes
6 answers

How to copy an object in Objective-C

I need to deep copy a custom object that has objects of its own. I've been reading around and am a bit confused as to how to inherit NSCopying and how to use NSCopyObject.
ben
  • 29,229
  • 42
  • 124
  • 179
115
votes
7 answers

Paste multiple times

What is the best way replace multiple lines with the contents of the clipboard? The problem I'm having is when I yank a line and paste it over another line the "yank" is replaced with the line I just replace. Now, if I want to replace another line…
jwerre
  • 9,179
  • 9
  • 60
  • 69
112
votes
9 answers

Simple way to copy a file

Is there any simple/fast way to copy a file in Go? I couldn't find a fast way in the Doc's and searching the internet doesn't help as well.
herb
  • 1,149
  • 2
  • 7
  • 4
111
votes
5 answers

Copy multiple directories with one command

Is there any way to copy multiple directories in one command, to reduce the number of layers? E.g., instead of: COPY dirone ./dirone COPY dirtwo ./dirtwo COPY dirthree ./dirthree I want to do: COPY dirone/ dirtwo/ dirthree/ ./ However, this copies…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
111
votes
11 answers

How to copy an array in Bash?

I have an array of applications, initialized like this: depends=$(cat ~/Depends.txt) When I try to parse the list and copy it to a new array using, for i in "${depends[@]}"; do if [ $i #isn't installed ]; then newDepends+=("$i") …
Kyle R.
  • 1,159
  • 2
  • 8
  • 5
110
votes
11 answers

Copy output of a JavaScript variable to the clipboard

I have no knowledge of JavaScript, but I managed to put this code together using bits and bolts from various Stack Overflow answers. It works OK, and it outputs an array of all selected checkboxes in a document via an alert box. function…
harman
  • 1,685
  • 2
  • 15
  • 14
108
votes
14 answers

How to copy a char array in C?

In C, I have two char arrays: char array1[18] = "abcdefg"; char array2[18]; How to copy the value of array1 to array2 ? Can I just do this: array2 = array1?
user2131316
  • 3,111
  • 12
  • 39
  • 53
106
votes
2 answers

Intellij IDEA with ideavim. Cannot copy text from another source

I tried to copy text from IDEA with ideavim plugin, using default vim keybindings (y). But this text isn't copied in global buffer and i can paste it only in IDEA. How can I use copied piece of text in browser, for example?
Supo
  • 1,135
  • 3
  • 8
  • 10