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
64
votes
7 answers

Is it possible to rename _id field after mongo's group aggregation?

I have a query like this (simplified): db.collection.aggregate([ { $match: { main_id: ObjectId("58f0f67f50c6af16709fd2c7") } }, { $group: { _id: "$name", count: { $sum: 1 }, sum: { $sum: { $add: ["$P31", "$P32"] } } } …
mykola
  • 1,736
  • 5
  • 25
  • 37
64
votes
8 answers

R dplyr: rename variables using string functions

(Somewhat related question: Enter new column names as string in dplyr's rename function) In the middle of a dplyr chain (%>%), I would like to replace multiple column names with functions of their old names (using tolower or gsub,…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
56
votes
8 answers

MongoDB rename database field within array

I need to rename indentifier in this: { "general" : { "files" : { "file" : [ { "version" : { "software_program" : "MonkeyPlus", "indentifier" : "6.0.0" } } ] }…
Andrew Samuelsen
  • 5,325
  • 9
  • 47
  • 69
56
votes
7 answers

How do I rename branch on the GitHub website?

I don't know how to run command line stuff. I just don’t have the environment. So I'm trying to rename a branch on the GitHub website. It was, by default, named patch-1. Is it possible to rename it on the site?
Noitidart
  • 35,443
  • 37
  • 154
  • 323
55
votes
8 answers

Linux: remove file extensions for multiple files

I have many files with .txt extension. How to remove .txt extension for multiple files in linux? I found that rename .old .new *.old substitutes .old extension to the .new Also I want to do this for files in sub-folders.
rp101
  • 1,239
  • 2
  • 10
  • 10
53
votes
2 answers

Renaming a file in NERDTREE

Is it possible to rename a file in NERDTree? I know about the m menu but there is no rename option.
Scientist1642
  • 1,172
  • 1
  • 11
  • 17
52
votes
6 answers

How to change folder names in python?

I have multiple folders each with the name of a person, with the first name(s) first and the surname last. I want to change the folder names so that the surname is first followed by a comma and then the first name(s) follow. As an example, in the…
user1130955
  • 523
  • 1
  • 4
  • 5
52
votes
5 answers

Re-order columns of table in Oracle

I have a table with 50+ columns and I need to swap the order of the first two columns. What is the best way to accomplish this using Oracle? Assume the table name is ORDERDETAILS and as it is, the first two columns are ITEM_ID and ORDER_ID. Once the…
Ryan Rodemoyer
  • 5,548
  • 12
  • 44
  • 54
52
votes
6 answers

How can I rename files with Grunt, based on the respective file's parent folder name?

I have a the following structure: src/ modules/ module1/ js/ main.js scss/ main.scss index.html module2/ js/ main.js …
keirog
  • 2,158
  • 1
  • 19
  • 17
51
votes
3 answers

How to rename an SVN branch and update references in an existing sandbox?

I needed to rename a SVN branch, so I did: $ svn move https://server/repos/myrepo/branches/oldbranch \ https://server/repos/myrepo/branches/newbranch So far, so good -- the branch has been renamed. The trouble is, we have existing sandboxes…
Lee Netherton
  • 21,347
  • 12
  • 68
  • 102
50
votes
8 answers

Renaming multiple files in a directory using Python

I'm trying to rename multiple files in a directory using this Python script: import os path = '/Users/myName/Desktop/directory' files = os.listdir(path) i = 1 for file in files: os.rename(file, str(i)+'.jpg') i = i+1 When I run this…
Simplicity
  • 47,404
  • 98
  • 256
  • 385
50
votes
1 answer

How to rename a file in .NET?

Using System.IO.File or another .NET class, what is the best way to rename a file? I want to be able to rename files on local drives or on network locations. If using System.IO.File, is Move the best way?
CJ7
  • 22,579
  • 65
  • 193
  • 321
49
votes
4 answers

How to dplyr rename a column, by column index?

The following code renames first column in the data set: require(dplyr) mtcars %>% setNames(c("RenamedColumn", names(.)[2:length(names(.))])) Desired results: RenamedColumn cyl disp hp drat wt qsec vs am gear…
Konrad
  • 17,740
  • 16
  • 106
  • 167
49
votes
3 answers

How can I rename my branch from TortoiseGit?

I know the way to rename branch from command line, but - since I'm using TortoiseGit - I'm curious if there are any options to do such thing. Thanks for the answers :)
Dombi Soma
  • 705
  • 1
  • 5
  • 11
47
votes
4 answers

Rename failed in Xcode 9

I used "renamed" function to rename a variable named "DefaultRequestURL" in Xcode 9, it alert this: alert image I have checked the file "ComposeController.swift", there is no "DefaultRequestURL"。 I have restart Xcode and do "Product -> Clean", it…
zephyr
  • 1,078
  • 1
  • 10
  • 13