renaming

replace names of all directiories and files in PS

给你一囗甜甜゛ 提交于 2019-11-30 21:05:08
I want to replace all space characters into "_" in names of all subfolders and files. Unfortunately when I type: Get-ChildItem -recurse -name | ForEach-Object { Rename-Item $_ $_.replace(" ","_") } Error message: Rename-Item : Source and destination path must be different. At line:1 char:60 + Get-ChildItem -recurse -name | ForEach-Object { Rename-Item <<<< $_ $ .replace(" "," ") } + CategoryInfo : WriteError: (PATH_HERE) [Rename-Item], IOException + FullyQualifiedErrorId : RenameItemIOError,Microsoft.PowerShell.Commands.RenameItemCommand How I should improve this short code? Don't use the Name

Rename File with Creation Date & Time in Windows Batch

不羁的心 提交于 2019-11-30 15:26:07
I have a directory tree with thousands of pdfs and tifs. A folder may contain multiple pdfs or tifs in that case they are numbered 1.pdf, 2.pdf etc... I have to make them available and making sure they are maually processed oldest files first - so I want to rename them with their creation date and time (1.pdf -> 20150415481876.pdf): Currently I use @echo off set datetime=%~t1 set name=%~n1 set extension=%~x1 set year=%datetime:~6,4% set month=%datetime:~3,2% set day=%datetime:~0,2% set hour=%datetime:~11,2% set min=%datetime:~14,2% ren %1 "%year%%month%%day%%hour%%min%%name%%extension%" This

a MYSQL script to convert the column names to lowercase

纵饮孤独 提交于 2019-11-30 09:45:48
I am looking for a single MYSQL script to convert ALL column names in a database to lowercase in one go... I have inherited a MYSQL database that has a lot of mixed case column names (150 tables with a strange naming convention) and I don't want to go through manually each table by table to do this. Has anyone got such a script? Thanks Adrian You can solve this task by building a script, starting with the output from this statement: SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = 'dbname'; ORDER BY table_name Details about this feature can be

Rename columns by pattern in R

試著忘記壹切 提交于 2019-11-30 05:57:11
问题 I would like to rename all my columns in a dataframe by a specific pattern. My input: Log.NE122 Log.NE244 Log.NE144 -0.33 0.98 1.0 My expected output: NE122 NE244 NE144 -0.33 0.98 1.0 Cheers. 回答1: You can use regular expressions to change the colnames() of an object. Here I'm replacing the Log. with nothing: colnames(object) <- sub("Log\\.", "", colnames(object)) 来源: https://stackoverflow.com/questions/23108808/rename-columns-by-pattern-in-r

Renaming a column in MS SQL Server 2005

筅森魡賤 提交于 2019-11-29 01:09:41
What is the best practice when it comes to renaming a table column using SQL (MS SQL Server 2005 variant)? This assumes that there is data in the column that must be preserved. Glen You have to use a stored proc to rename a column. The following will rename your column from 'oldColumnName' to 'newColumnName' without affecting any data. EXEC sp_rename 'tableName.[oldColumnName]', 'newColumnName', 'COLUMN' Obviously you'll have to update any code / stored procs / SQL that uses the old name manually. I had the same problem today, and the solution was kill all processes on the database, cause the

Rename or refactor files in Xcode

社会主义新天地 提交于 2019-11-28 04:48:29
Is it possible to rename/refactor a class file and have it rename the actual file on disk? If so, how can I do this? The safest way to rename files is to refactor the class name using Xcode's "Refactor" command . Using that command makes sure that your code is also updated anywhere that references the file or the class (including NIBs). Right-click on the class name in the interface ( .h ) file, choose Refactor->Rename , and Xcode will guide you through the process, allowing you to preview changes before you commit to them. More details: Right click on the class name (after @interface ) and

How to remove spaces from file names (in bulk)

这一生的挚爱 提交于 2019-11-28 04:44:25
How to remove spaces (not replace with underscores) from several thousand files in bulk in Windows? Can I do this from the DOS command? Currently: file one.mp3 file two.mp3 All files need to become: fileone.mp3 filetwo.mp3 Here is a script that can efficiently bulk rename files, stripping all spaces from the name. :renameNoSpace [/R] [FolderPath] @echo off setlocal disableDelayedExpansion if /i "%~1"=="/R" ( set "forOption=%~1 %2" set "inPath=" ) else ( set "forOption=" if "%~1" neq "" (set "inPath=%~1\") else set "inPath=" ) for %forOption% %%F in ("%inPath%* *") do ( if /i "%~f0" neq "%%~fF"

Using variable value as column name in data.frame or cbind

本小妞迷上赌 提交于 2019-11-27 22:58:44
Is there a way in R to have a variable evaluated as a column name when creating a data frame (or in similar situations like using cbind)? For example a <- "mycol"; d <- data.frame(a=1:10) this creates a data frame with one column named a rather than mycol . This is less important than the case that would help me remove quite a few lines from my code: a <- "mycol"; d <- cbind(some.dataframe, a=some.sequence) My current code has the tortured: names(d)[dim(d)[2]] <- a; which is aesthetically barftastic. > d <- setNames( data.frame(a=1:10), a) > d mycol 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Is

Renaming a column in MS SQL Server 2005

旧城冷巷雨未停 提交于 2019-11-27 15:41:06
问题 What is the best practice when it comes to renaming a table column using SQL (MS SQL Server 2005 variant)? This assumes that there is data in the column that must be preserved. 回答1: You have to use a stored proc to rename a column. The following will rename your column from 'oldColumnName' to 'newColumnName' without affecting any data. EXEC sp_rename 'tableName.[oldColumnName]', 'newColumnName', 'COLUMN' Obviously you'll have to update any code / stored procs / SQL that uses the old name

How to remove spaces from file names (in bulk)

让人想犯罪 __ 提交于 2019-11-27 00:37:40
问题 How to remove spaces (not replace with underscores) from several thousand files in bulk in Windows? Can I do this from the DOS command? Currently: file one.mp3 file two.mp3 All files need to become: fileone.mp3 filetwo.mp3 回答1: Here is a script that can efficiently bulk rename files, stripping all spaces from the name. :renameNoSpace [/R] [FolderPath] @echo off setlocal disableDelayedExpansion if /i "%~1"=="/R" ( set "forOption=%~1 %2" set "inPath=" ) else ( set "forOption=" if "%~1" neq ""