rename

How can I rename a collection in MongoDB?

六眼飞鱼酱① 提交于 2020-08-20 19:21:04
问题 Is there a dead easy way to rename a collection in mongo? Something like: db.originalCollectionName.rename('newCollectionName'); And if not, what is the best way to go about effectively renaming one? 回答1: Close. Use db.originalCollectionName.renameCollection('newCollectionName') See http://www.mongodb.org/display/DOCS/renameCollection+Command 回答2: For those who cannot rename, because the name causes an issue like: SyntaxError: Unexpected token ILLEGAL, it is because the name is illegal. You

PowerShell File rename

走远了吗. 提交于 2020-07-11 04:13:08
问题 How to ignore file rename if the filename already contains string during file rename process. My example: Get-ChildItem "D:\Shares\WinCAP Data\DAYPROT\OFS-222_2\*.csv" | Rename-Item -NewName { $_.Name -replace "\.csv", "TC.csv" } I would like to rename just files without string "TC" in filename - for example: abc.csv to rename defTC.csv do not want to rename 回答1: You could filter off the files which don't require the rename with a regex: ?{!($_.fullname -match "TC\.csv")} So, for your example

PowerShell File rename

老子叫甜甜 提交于 2020-07-11 04:12:51
问题 How to ignore file rename if the filename already contains string during file rename process. My example: Get-ChildItem "D:\Shares\WinCAP Data\DAYPROT\OFS-222_2\*.csv" | Rename-Item -NewName { $_.Name -replace "\.csv", "TC.csv" } I would like to rename just files without string "TC" in filename - for example: abc.csv to rename defTC.csv do not want to rename 回答1: You could filter off the files which don't require the rename with a regex: ?{!($_.fullname -match "TC\.csv")} So, for your example

Rename duplicate files in a zip file Java

别来无恙 提交于 2020-06-29 07:28:10
问题 I have several files including duplicates which I have to compress into an archive.Do you know some tool able to rename duplicate files before creating the archive ex(cat.txt, cat(1).txt, cat(2).txt ...)? 回答1: I have created the following code that easily removes duplicates: static void renameDuplicates(String fileName, String[] newName) { int i=1; File file = new File(fileName + "(1).txt"); while (file.exists() && !file.isDirectory()) { file.renameTo(new File(newName[i-1] + ".txt")); i++;

search and replace functions to rename columns

ぐ巨炮叔叔 提交于 2020-06-27 17:43:09
问题 I have data frame like this > d <- data.frame(team.aaa=1:3, team.aab=4:6, team.aac=7:9) > d # team.aaa team.aab team.aac #1 1 4 7 #2 2 5 8 and, desired output d <- rename(d, c("team.aaa"="aaa_team", "team.aab"="aab_team", "team.aac"="aac_team")) > d # aaa_team aab_team aac_team #1 1 4 7 #2 2 5 8 #3 3 6 9 I could do it with rename string, but want to use search and replace option because of huge data volume Many thanks in advance 回答1: Based on the example showed in the OP's post, it seems that

How can I change name of arbitrary columns in pandas df using lambda function?

戏子无情 提交于 2020-06-25 09:49:04
问题 Is there any way to change some column names in pandas dataframe using lambda , but not all? For example, suppose that this data frame has columns whose name are osx , centos , ubunto , windows . In this data frame, I want to replace all column names with that column name appended by x , so in this case, I can rename the column name by: df.rename(columns=lambda x: x+'x') However, if I want to rename all column names other than ubunto , how can I do it? So what I want to get is data frame