Questions tagged [overwrite]

Overwriting is a process of replacing content with other content in place. It can be physically replaced on storage, or overridden with newer version of content type.

Overwriting is a process of replacing content with other content in place. It can be physically replaced on storage, or overridden with newer version of content type.
Not to be confused with Override in Object Oriented Programming.

1342 questions
8002
votes
50 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under…
Jakub Troszok
  • 84,701
  • 10
  • 36
  • 49
739
votes
16 answers

How to force cp to overwrite without confirmation

I'm trying to use the cp command and force an overwrite. I have tried cp -rf /foo/* /bar, but I am still prompted to confirm each overwrite.
thiyagu114
  • 8,904
  • 5
  • 19
  • 18
169
votes
5 answers

Overwrite or override

It might seem to be a stupid question but I'm just so curious and want to use the correct term when talking about the issue. Couldn't find a similar question here so I decided to create a new one. Should we refer to "replacing an implementation"…
Kent Nguyen
  • 2,452
  • 2
  • 18
  • 15
131
votes
10 answers

How to overwrite existing files in batch?

The following command copies and moves a file but I also need it to overwrite the file it's replacing. xcopy /s c:\mmyinbox\test.doc C:\myoutbox
Mal
  • 1,311
  • 2
  • 8
  • 3
119
votes
6 answers

Read and overwrite a file in Python

Currently I'm using this: f = open(filename, 'r+') text = f.read() text = re.sub('foobar', 'bar', text) f.seek(0) f.write(text) f.close() But the problem is that the old file is larger than the new file. So I end up with a new file that has a part…
compie
  • 9,449
  • 15
  • 51
  • 73
72
votes
7 answers

Python - Move and overwrite files and folders

I have a directory, 'Dst Directory', which has files and folders in it and I have 'src Directory' which also has files and folders in it. What I want to do is move the contents of 'src Directory' to 'Dst Directory' and overwrite anyfiles that exist…
Artharos
  • 847
  • 1
  • 7
  • 9
52
votes
5 answers

Python, Overriding an inherited class method

I have two classes, Field and Background. They look a little bit like this: class Field( object ): def __init__( self, a, b ): self.a = a self.b = b self.field = self.buildField() def buildField( self ): …
d00nut
  • 623
  • 1
  • 5
  • 6
51
votes
6 answers

How to overwrite a folder if it already exists when creating it with makedirs?

The following code allows me to create a directory if it does not already exist. dir = 'path_to_my_folder' if not os.path.exists(dir): os.makedirs(dir) The folder will be used by a program to write text files into that folder. But I want to…
Shankar Kumar
  • 1,699
  • 6
  • 21
  • 29
39
votes
2 answers

Python: How to force overwriting of files when using setup.py install (distutil)

I am using distutil to install my python code using python setup.py install I run into problems when I want to install an older branch of my code over a new one: setup.py install won't overwrite older files. A work around is touching (touch…
33
votes
5 answers

Overwriting txt file in java

The code I've written is supposed to overwrite over the contents of the selected text file, but it's appending it. What am I doing wrong exactly? File fnew=new File("../playlist/"+existingPlaylist.getText()+".txt"); String source =…
Karthik Balakrishnan
  • 4,153
  • 6
  • 34
  • 65
31
votes
4 answers

Can Gulp overwrite all src files?

Let's say I want to replace the version number in a bunch of files, many of which live in subdirectories. I will pipe the files through gulp-replace to run the regex-replace function; but I will ultimately want to overwrite all the original…
davidtheclark
  • 4,398
  • 4
  • 28
  • 42
29
votes
1 answer

Append to a File with fstream Instead of Overwriting

I'm trying to create a basic highscore system for a project I'm working on. The problem I'm having is, although I write the names into my main they just overwrite the previous. Currently I have this: void ManagePoint::saveScore(string Name, int…
Springfox
  • 1,139
  • 2
  • 10
  • 11
26
votes
6 answers

How to 'update' or 'overwrite' a python list

aList = [123, 'xyz', 'zara', 'abc'] aList.append(2014) print aList which produces o/p [123, 'xyz', 'zara', 'abc', 2014] What should be done to overwrite/update this list. I want the o/p to be [2014, 'xyz', 'zara', 'abc']
pyLearner
  • 361
  • 1
  • 3
  • 6
25
votes
9 answers

How to write data to a text file without overwriting the current data

I can't seem to figure out how to write data to a file without overwriting it. I know I can use File.appendtext but I am not sure how to plug that into my syntax. Here is my code: TextWriter tsw = new StreamWriter(@"C:\Hello.txt"); //Writing text…
llk
  • 2,191
  • 6
  • 33
  • 43
24
votes
2 answers

how to overwrite data in a txt file?

Possible Duplicate: Can any one tell why the previous data is still displayed while saving data using StreamWriter I have WPF C# application, that reads and writes to a .txt file, i know how to write line but line, but how do I overwrite the text…
Beef
  • 1,373
  • 5
  • 18
  • 36
1
2 3
89 90