Skip to main content
Filter by
Sorted by
Tagged with
3940 votes
21 answers
4.1m views

How do I copy a file in Python?
Matt's user avatar
  • 88.7k
936 votes
23 answers
1.6m views

Consider the code below: DummyBean dum = new DummyBean(); dum.setDummy("foo"); System.out.println(dum.getDummy()); // prints 'foo' DummyBean dumtwo = dum; System.out.println(dumtwo.getDummy()); // ...
Veera's user avatar
  • 33.3k
753 votes
31 answers
887k views

What is the difference between a deep copy and a shallow copy?
David Locke's user avatar
  • 18.1k
635 votes
29 answers
525k views

I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method ...
Keith's user avatar
  • 157k
554 votes
7 answers
336k views

While reading up the documentation for dict.copy(), it says that it makes a shallow copy of the dictionary. Same goes for the book I am following (Beazley's Python Reference), which says: The m....
user225312's user avatar
  • 133k
419 votes
11 answers
879k views

I have an array a which is constantly being updated. Let's say a = [1,2,3,4,5]. I need to make an exact duplicate copy of a and call it b. If a were to change to [6,7,8,9,10], b should still be [1,2,3,...
badcoder's user avatar
  • 3,864
383 votes
10 answers
581k views

How do I transfer the items contained in one List to another in C# without using foreach?
ratty's user avatar
  • 13.5k
355 votes
8 answers
969k views

I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is the SQL statement to do ...
RyanKeeter's user avatar
  • 6,219
324 votes
10 answers
418k views

In bash I need to do this: take all files in a directory copy them into an existing directory How do I do this? I tried cp -r t1 t2 (both t1 and t2 are existing directories, t1 has files in it) but ...
David Chang's user avatar
  • 3,241
304 votes
12 answers
163k views

import copy a = "deepak" b = 1, 2, 3, 4 c = [1, 2, 3, 4] d = {1: 10, 2: 20, 3: 30} a1 = copy.copy(a) b1 = copy.copy(b) c1 = copy.copy(c) d1 = copy.copy(d) print("immutable - id(a)==id(a1)", id(a) == ...
deeshank's user avatar
  • 4,515
301 votes
5 answers
204k views

How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing git ls-tree master:dirname I can then copy all of the files individually by doing ...
alexenko's user avatar
  • 3,313
291 votes
19 answers
548k views

I am trying to use my Mac Terminal to scp a file from Downloads (phpMyAdmin I downloaded online) to my Amazon EC2 instance. The command I used was: scp -i myAmazonKey.pem phpMyAdmin-3.4.5-all-...
HoKy22's user avatar
  • 4,227
269 votes
16 answers
424k views

I would like to write a script which copies my current database sitedb1 to sitedb2 on the same mysql database instance. I know I can dump the sitedb1 to a sql script: mysqldump -u root -p sitedb1 >...
uclajatt's user avatar
  • 4,323
267 votes
7 answers
191k views

I have a somewhat confusing question in Git. Lets say, I have a file dir1/A.txt committed and git preserves a history of commits Now I need to copy the file into dir2/A.txt (not move, but copy). I ...
Mark Bramnik's user avatar
  • 42.9k
258 votes
15 answers
187k views

How to copy list in Kotlin? I'm using val selectedSeries = mutableListOf<String>() selectedSeries.addAll(series) Is there a easier way?
Adolf Dsilva's user avatar
  • 14.6k
246 votes
4 answers
289k views

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 ...
user710818's user avatar
  • 24.4k
232 votes
2 answers
47k views

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 ...
Peter Fine's user avatar
  • 2,933
214 votes
9 answers
178k views

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: <?php class A { public $...
Nick Stinemates's user avatar
203 votes
3 answers
62k views

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 ...
Hexdoll's user avatar
  • 2,216
196 votes
4 answers
226k views

There seems to be several ways to create a copy of a tensor in PyTorch, including y = tensor.new_tensor(x) #a y = x.clone().detach() #b y = torch.empty_like(x).copy_(x) #c y = torch.tensor(x) #d b ...
dkv's user avatar
  • 7,392
190 votes
15 answers
369k views

I have a List<SomeBean> 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 ...
Mono Jamoon's user avatar
  • 4,627
187 votes
13 answers
377k views

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 ...
Fero's user avatar
  • 13.3k
185 votes
5 answers
349k views

Is there a way to copy directories recursively inside a .bat file? Is an example of this available?
sarsnake's user avatar
  • 28k
181 votes
10 answers
380k views

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 ...
Ali's user avatar
  • 268k
178 votes
9 answers
446k views

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 ...
Surya's user avatar
  • 3,518

1
2 3 4 5
227