Questions tagged [rename]

For anything regarding renaming. Could be applicable to a wide range of subjects. Should be replaced by a more domain-specific tag if applicable.

Questions regarding renaming one or many files, directories, projects, variables, users, data cells, and version control conflicts arising from renaming should be tagged with rename.

To rename a file means to give an existing file a new name without changing any of its content. In UNIX systems, this is done with the mv command.

Renaming a variable will usually require a find-and-replace edit in existing code.

5438 questions
136
votes
11 answers

How to rename with prefix/suffix?

How do I do mv original.filename new.original.filename without retyping the original filename? I would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything…
Peter Boughton
  • 110,170
  • 32
  • 120
  • 176
135
votes
4 answers

git diff renamed file

I have a file a.txt. cat a.txt > hello The contents of a.txt is "hello". I make a commit. git add a.txt git commit -m "first commit" I then move a.txt into a test dir. mkdir test mv a.txt test I then make my second commit. git add -A git commit…
Ken Hirakawa
  • 7,831
  • 10
  • 38
  • 49
134
votes
12 answers

How do I rename a column in a database table using SQL?

If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible? This is for any database claiming to support SQL, I'm simply looking for an SQL-specific…
MetroidFan2002
  • 29,217
  • 16
  • 62
  • 80
132
votes
9 answers

Changing file extension in Python

Suppose from index.py with CGI, I have post file foo.fasta to display file. I want to change foo.fasta's file extension to be foo.aln in display file. How can I do it?
MysticCodes
  • 3,092
  • 5
  • 25
  • 33
123
votes
7 answers

Replacement for "rename" in dplyr

I like plyr's renaming function rename. I have recently started using dplyr, and was wondering if there is an easy way to rename variables using a function from dplyr, that is as easy to use as to plyr's rename?
vergilcw
  • 2,093
  • 4
  • 16
  • 20
119
votes
9 answers

Renaming xcode 4 project and the actual folder

I know how to rename the project in Xcode 4, but how do you rename the source folder? The thing is that renaming the project in Xcode, does only rename within Xcode (Though it is progress compared to previous) - but why Xcode is not renaming the…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
119
votes
9 answers

Rename all files in a folder with a prefix in a single command

Rename all the files within a folder with prefix "Unix_" Suppose a folder has two files a.txt b.pdf then they both should be renamed from a single command to Unix_a.txt Unix_b.pdf
vasanthi
  • 1,199
  • 2
  • 8
  • 3
118
votes
21 answers

Rename multiple columns by names

Someone should have asked this already, but I couldn't find an answer. Say I have: x = data.frame(q=1,w=2,e=3, ...and many many columns...) what is the most elegant way to rename an arbitrary subset of columns, whose position I don't necessarily…
qoheleth
  • 2,219
  • 3
  • 18
  • 23
117
votes
11 answers

Rename MySQL database

I created a database with the name of hrms. Now I need to change database name to sunhrm. But, It is disabled in MySQL workbench. Can I do that on the Linux server itself?
Dhileepan
  • 2,037
  • 8
  • 24
  • 28
114
votes
4 answers

Is it possible to rename an AWS Lambda function?

I have created some AWS Lambda functions for testing purposes (named as test_function something), then after testing I found those functions can be used in prod environment. Is it possible to rename the AWS Lambda function? and how? Or should I…
Sabrina Luo
  • 3,810
  • 4
  • 16
  • 35
114
votes
6 answers

Renaming part of a filename

I have loads of files which look like this: DET01-ABC-5_50-001.dat ... DET01-ABC-5_50-0025.dat and I want them to look like this: DET01-XYZ-5_50-001.dat ... DET01-XYZ-5_50-0025.dat How can I do this?
not_a_geek
  • 1,157
  • 2
  • 9
  • 6
111
votes
5 answers

Why might git log not show history for a moved file, and what can I do about it?

I've renamed a couple of files using git mv, used git stash, had a quick look at HEAD (without changing it) then did git stash pop to get the whole lot back again. My moves had disappeared from the commit list, so I redid them with git rm and the…
please delete me
106
votes
3 answers

How to rename git root folder?

I've just started using git in Vista, with my repository under /path/to/project/git repo. I've now found that the space in the folder name is a minor irritation when working in git bash. Can I just rename the folder to /path/to/project/gitrepo? Is…
Mick O'Hea
  • 1,619
  • 2
  • 14
  • 20
106
votes
14 answers

Batch Renaming of Files in a Directory

Is there an easy way to rename a group of files already contained in a directory, using Python? Example: I have a directory full of *.doc files and I want to rename them in a consistent way. X.doc -> "new(X).doc" Y.doc -> "new(Y).doc"
Nate
  • 18,892
  • 27
  • 70
  • 93
98
votes
8 answers

How to rename rails controller and model in a project

I started a Rails app and everything works fine. But now, I would like to rename a controller and the associated model: I wanted to change the Corps controller to Stores and the same (without final s) for the model. Looking on google, people…
Hassen
  • 6,966
  • 13
  • 45
  • 65