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
105
votes
16 answers

How to programmatically move, copy and delete files and directories on SD?

I want to programmatically move, copy and delete files and directories on SD card. I've done a Google search but couldn't find anything useful.
Tony
  • 1,603
  • 3
  • 21
  • 40
105
votes
6 answers

How to copy directory recursively in python and overwrite all?

I'm trying to copy /home/myUser/dir1/ and all its contents (and their contents, etc.) to /home/myuser/dir2/ in python. Furthermore, I want the copy to overwrite everything in dir2/. It looks like distutils.dir_util.copy_tree might be the right tool…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
104
votes
5 answers

Create copy of multi-dimensional array, not reference - JavaScript

This is also referred to as "deep copying", which I've found some articles on. Closest seems to be this one but it's for jQuery - I'm trying to do this without a library. I've also seen, in two places, that it's possible to do something like: arr2 =…
Randy Hall
  • 7,716
  • 16
  • 73
  • 151
102
votes
7 answers

Copying a local file from Windows to a remote server using scp

I try to transfer a folder of files from my local computer to a server via ssh and scp. After getting sudo privileges, I'm using the command as follows: scp -r C:/desktop/myfolder/deployments/ user@host:/path/to/whereyouwant/thefile However, I get…
HelloWorld
  • 4,251
  • 8
  • 36
  • 60
97
votes
11 answers

SQL Server - copy stored procedures from one db to another

I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager - Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new…
Oak
  • 1,159
  • 3
  • 13
  • 21
94
votes
6 answers

Copying std::vector: prefer assignment or std::copy?

I have two vectors: std::vector v1, v2; // Filling v1 ... And now I need to copy v1 to v2. Is there any reason to prefer v2 = v1; to std::copy (v1.begin(), v1.end(), v2.begin()); (or vice versa)?
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
93
votes
7 answers

Fast way to copy dictionary in Python

I have a Python program that works with dictionaries a lot. I have to make copies of dictionaries thousands of times. I need a copy of both the keys and the associated contents. The copy will be edited and must not be linked to the original (e.g.…
Joern
  • 933
  • 1
  • 6
  • 4
92
votes
5 answers

Copying sets Java

Is there a way to copy a TreeSet? That is, is it possible to go Set itemList; Set tempList; tempList = itemList; or do you have to physically iterate through the sets and copy them one by one?
SNpn
  • 2,157
  • 8
  • 36
  • 53
92
votes
5 answers

How to make a copy of a 2D array in Python?

X is a 2D array. I want to have a new variable Y that which has the same value as the array X. Moreover, any further manipulations with Y should not influence the value of the X. It seems to me so natural to use y = x. But it does not work with…
Roman
  • 124,451
  • 167
  • 349
  • 456
92
votes
3 answers

Unix - copy contents of one directory to another

Folder1/ -fileA.txt -fileB.txt -fileC.txt > mkdir Folder2/ > [copy command] And now Folder2/ looks like: Folder2/ -fileA.txt -fileB.txt -fileC.txt How to make this happen? I have tried cp -r Folder1/ Folder2/ but I…
JDS
  • 16,388
  • 47
  • 161
  • 224
92
votes
8 answers

jQuery: get the file name selected from

This code should work in IE (don't even test it in Firefox), but it doesn't. What I want is to display the name of the attached file. Any help? example