FAQ Database Discussion Community


Rename Variable Regardless of its Name in SAS

sas,rename
Lets suppose we have the following dataset: ID Stress_Level Heart_Rate 1 5 10 2 7 12 3 9 16 And the code one would use to rename a variable would be: data test1; set test0; rename Stress_Level=A Heart_Rate=B; run; However, what I would like to do is to rename the...

Change ID in File

java,file,text,path,rename
Let's say I have this notepad file name: Company_XXX_768_JGH.txt Contents: Random Text Blah Blah Blah Network ID: 80801568 I need to change the ID last 4 numbers (1568) to (0003). So far I am able to read the whole, find the line with the number AND print a statement for...

Batch script, file drag&drop, change extension and reload file

batch-file,drag-and-drop,rename,file-extension
I have a batch script which accepts >=1 files via drag & drop. The full paths are kept in an array and later fed to another program as input. The file name+extension is kept in another array which is then shown to the user. I am trying to check the...

Replacing levels of multiple factors

r,rename,level,factors
I would need to replace the levels of multiple factors in one data frame, so they would be all unified. These are, for example, the levels in the one of those factors: > levels(workco[,5]) [1] " " "1" "2" [4] "kóko" "kesätyö" "Kesätyö kokoaika" [7] "koko" "kokop" "kokop." [10] "Kokopäivä"...

Rename batch of specific files using bash

osx,bash,file,rename
Say I have a folder which contains files like this: a constant prefix and then an underscore and some description which is different for every file: constantnamehere_description1.doc constantnamehere_description2.doc . . etc Here description1, description2 etc just symbolized the different descriptions and not the actual number 1,2 etc.. How can I...

How to rename maven modules?

eclipse,maven,svn,module,rename
I have small project in which there are three modules: <modules> <module>ejb</module> <module>web</module> <module>ear</module> </modules> I wish to rename these maven modules. First thing i tried was, just rename module names pom.xml of parent. e.g. <modules> <module>ejb-ext</module> <module>web-ext</module> <module>ear-ext</module> </modules> When I tried to compile the project, maven complained that...

R: ne-name factor-values in data.frame

r,class,integer,data.frame,rename
EDITED I have a data.frame [integer_disc] that consists of integer variables (with values 1,2,3). The dataframe has about 120 columns and 54,000 rows. Below is a snipped Col1 Col2 Col3 Col 4 [up to Col 120] 1 2 1 1 3 1 2 1 2 2 2 2 1 3...

Renaming files in folder using shell script

perl,shell,video,rename
I have downloaded a playlist of videos and want to organise them using a file called android playlist. For eg: the first file with some title like "Introduction to Android.mp4" , I have to rename it as 1.mp4 . I don't know perl or unix but I have managed to...

How to rename a database in Web SQL?

sql,database,rename,web-sql
Is there a way to rename a database in Web SQL? I need a simple way to backup all data to another Web SQL database.

Rename All files in a Folder and replace the name with the creationTime Using PowerShell

powershell,rename
I want to write a function which replace the name of each file with the current name followed by the creatiomTime. This is my function : Function RenameFolderFiles{ Param([String]$path) Get-Childitem $path -Recurse | Rename-Item -NewName { $_.Name -Replace "$_.Name$_.CreationTim" } } But it doesn't work. Any ideas? Thank you...

DrRacket keyboard shortcut for α-rename

keyboard-shortcuts,racket,rename
How can I bind a keyboard shortcut (e.g. F2) to α-rename in DrRacket, available as rename foobar in the context menu brought up by right-clicking on a variable name? The documentation boils down to "call a magic function name from the API", but I'm having a hard time finding that...

Shell script to copy and prepend folder name to files from multiple subdirectories

linux,shell,unix,rename,batch-rename
I have several folders with different images sharing file names, with a folder structure like this: /parent/folder001/img001.jpg /parent/folder001/img002.jpg /parent/folder002/img001.jpg /parent/folder002/img002.jpg /parent/folder003/img001.jpg /parent/folder003/img002.jpg ...and would like to copy/rename these files into a new folder, like this: /newfolder/folder001_img001.jpg /newfolder/folder001_img002.jpg /newfolder/folder002_img001.jpg /newfolder/folder002_img002.jpg /newfolder/folder003_img001.jpg /newfolder/folder003_img002.jpg...

bash - rename fasta headers and filenames within subdirectories - append prefix

bash,recursion,sed,rename,bioinformatics
A simplified example of my file structure is this: /Assemblies/A_velvet/contigs.fasta /Assemblies/A_velvet/info.log /Assemblies/BB_velvet/contigs.fasta /Assemblies/BB_velvet/info.log I am trying to write a script that I can pass the Assemblies directory - then it will: loop through each subdirectory (A_velvet, BB_velvet) - take the strain name (A, BB) add it as a prefix to...

How to change an app's name displayed in app store before submitting for review?

ios,iphone,itunesconnect,rename
My app's status is "prepare for submission" (way before going live), so there must be a simple way to change its name, but I really can't figure it out on my own; help's needed! I need to change the name displayed in app store, not in xcode!

PowerShell file rename and counter issue

powershell,rename,counter
I have made a very simple ps1 script that rename my txt files with an "ID" number like Card.321.txt This works for simple lines, but I need a mass rename of lines, so I need something different. $i = 1 Get-ChildItem *.txt | %{Rename-Item $_ -NewName ('Card.{0:D3}.txt' -f $i++)} But...

Remove whitespace from all filenames in directory - Java

java,image,directory,whitespace,rename
I have directory of images and I want to rename the files by removing all of the whitespace in the name. So let's say I have a file name called " f il ena me .png" (I plan on checking all of the file names in the directory). How might...

How to remove numbers from extensions from files

file,shell,rename
I have many files in a directory having extension like .text(2) and .text(1). I want to remove the numbers from extension and output should be like .text and .text . can anyone please help me with the shell script for that? I am using centOs.

Python: Rename duplicates in list with progressive numbers without sorting list

python,list,duplicates,rename
Given a list like this: mylist = ["name", "state", "name", "city", "name", "zip", "zip"] I would like to rename the duplicates by appending a number to get the following result: mylist = ["name1", "state", "name2", "city", "name3", "zip1", "zip2"] I do not want to change the order of the original...

ionic serve fails after renaming app

ionic-framework,rename,ionic
First, I renamed the repository directory for my app, mv fooapp barapp. I did a search and replace for literally every instance of every casing of my app's old name, "FooApp", in the repository where it lives. grep -R -i FooApp * returns absolutely nothing. I then deleted node_modules/ and...

Truncate filename after a multiple of a special character in windows batch script?

windows,batch-file,rename
I want to remove the part of a filename after the third "_" from thousand of files. The structure after the third "_" varies and contains "_" in some cases. The length of the first part varies so I can't just remove the first 15 characters. The result should be...

Dropbox synching (rename)

php,dropbox,rename
I am trying to keep my files updated via a Dropbox synchronisation. The setup: I am using Dropbox webhooks to get notified of changes in the box I ask the Dropbox server for a /delta I analyze the delta array The array consists of multiple entries, however (for me), a...

Android Studio renaming

android,android-studio,rename
I recently renamed my Android app project in Android Studio (1.1b4) project, but am now unable to rebuild. I get this error: Error:Execution failed for task ':app:clean'. > Unable to delete directory: D:\AndroidstudioProjects\PcUpload\app\build\intermediates\res\release\values-sw600dp-v13 I renamed by right-clicking the top-level in the Project hierarchy, then selecting "Refactor...Rename". Can anyone advise how...

How to use the contents of a text file(tab delimited format) to rename files in a folder?

c,windows,string,rename
I'm trying to make e-certificates to distribute for one of my college events. I used Photoshop to generate batch certificates with different names and roll nos. Now the files are named core_01Data Set 1.jpg, core_02Data Set 2.jpg, etc. In order to distribute them online, they need to renamed and sorted...

Remove folder with special character on it

linux,delete,directory,special-characters,rename
I accidentally created some folders with special characters. I already read the other posts in stackoverflow, but don't work. When I type the ls -la command I see [email protected]:/myfolder# ls -la drwxr-xr-x 3 root root 4096 feb 6 17:53 , drwxr-xr-x 70 root root 4096 feb 11 10:27 . drwxr-xr-x...

A better way to rename keys of a dictionary after deletion of an item?

python,dictionary,data-structures,rename
I have a dictionary that I am using. I occasionally delete values from it and then have to go back through and rename the keys. I am accomplishing the renaming like so: TestDic = {0: "Apple", 2: "Orange", 3: "Grape"} print(TestDic) TempDic = {} i = 0 for Key, DictValue...

How does one rename multiple files using python?

python,file,python-3.x,append,rename
I have lots of programming experience but this is my first python script. I am trying to add the prefix "00" to all the files in a specific folder. First I read the names of all the files and save them in an array. Then I sort through the array...

How to rename a remote git branch name

git,repository,rename,git-branch
I have 4 braches like master -> origin/regacy, FeatureA -> origin/FeatureA. As you can see above, I typed a wrong name. So I want to rename a remote branch name ( origin/regacy => origin/legacy or origin/master) I try to command below. git remote rename regacy legacy But git console retured...

I can't alter table in mysql [duplicate]

mysql,rename
This question already has an answer here: How to rename a table column in MySQL 8 answers Im trying to rename a column in one of my tables but MySQL returns me this error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that...

use ubuntu **rename** command for folders

ubuntu,rename,bulk
I want to use the rename command to change the names of multiple folders, not files. I need an example of how to rename \test 1\ \test 2\ \test 3\ to \1\ \2\ \3\

Script to change name stops after Dynamic selection

java,rename,business-catalyst
I need to change text within an un-accessible module in Adobe Business Catalyst so far i have the following working but once an option on the screen is updated the script doesn't run again. How do i make it auto refresh/run? $(document).ready(function(){ $.fn.replaceText = function( search, replace, text_only ) {...

How to rename duplicate lines with awk?

awk,duplicates,rename
I have a file with 1 million lines and some lines are duplicate. I would like to rename the duplicate lines by appending "variant" + a number. The file is formatted as follows: I am a test line She is beautiful need for speed Nice day today I am a...

Rename dicom images

matlab,rename,dicom
I have 110 CT dicom images, and their names are randoms, so when I display them using any dicom viewer, they are displayed randomly. Thus I am trying to rename these dicom images according to their Image Number (0020,0013) or Slice Location (0020,1041). I have already started to write a...

How to match strings in file names and rename file according to string?

linux,bash,rename
I have many files with matching strings in file names. foostring.bar barstring.bar fuustring.bar aha_foostring.abc meh_barstring.abc lol_fuustring.abc ... I need to find the bar and abc files with matching strings, and rename the *.bar-files basename to the look like the *.abc-files. In other words, add a string prefix. The result I'm...

Only conserve the name of the folder in a .txt file with a complete directory (Batch)

windows,batch-file,directory,folder,rename
(I DIDN'T DO A BATCH WITH THIS STUFF YET) I have a file called "worldcopy2.txt" which inside has a full directory: C:\Users\Robert\Desktop\myworld2 And I want to create a batch file to change the inside of the .txt to only have the name of the last folder of the directory that...

Rename support for derived names in DrRacket

racket,rename,automated-refactoring
When a macro produces bindings using derived names, these are not considered references to the original name (which is expected behaviour). However, renaming doesn't work on the derived names. Here is a simple macro example: (define-syntax (my-syntax stx) (syntax-case stx () [(_ name) (with-syntax ([get-name (format-id #'name "get-~a" #'name)]) #'(begin...

Renaming multiple images with .rename and .endswith

python,rename,batch-rename
I've been trying to get this to work, but I feel like I'm missing something. There is a large collection of images in a folder that I need to rename just part of the filename. For example, I'm trying to rename the "RJ_200", "RJ_600", and "RJ_60"1 all to the same...

PHP rename and concatenation adds extra numbers

php,loops,folder,rename
I have the following code which operates as follows: option 1 renames the files in a folder with a random string option 2 renames the files in an incremental manner. The issue is for some reason the loop runs twice, leaving me with numbers starting from greater than 0. Can...

R dplyr: rename variables using string functions

regex,r,rename,dplyr
(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, etc.) library(tidyr); library(dplyr) data(iris) # This is what I want to...

Copy file1 name inplace of file2 and add extra to it, but not copy file1 extention

java,file,copy,filenames,rename
How can i change the name of a file to match the original file and have extra txt in it, please see example below Original dataFile.txt thisNameNeedsToMatchDataFile.txt (but also have ".Step2" added in before the .txt) Desired output dataFile.txt dataFile.Step2.txt Any help would be appropriated thank you in advanced....

How to rename a file in C++

c++,rename,dev-c++
The part of code where I rename the file just won't work. I tried writing it separately in another project, it works. Help me please. #include <iostream> #include <stdio.h> #include <fstream> using namespace std; int main () { char address[] = ""; char newname[] = ""; int action; char confirm;...

A smart python program that renames file names

python,python-2.7,rename
So, I was making a python program that renames A.txt to B.txt, but I wanted the program to skip and move on if there is file "B.txt" already in the folder. Meanwhile, if there is neither A or B in the folder, then there is something wrong so I want...

How to rename project in Android Studio `Reopen Project` list?

ubuntu,android-studio,project,rename
Anyone knows how to rename this recently opened project "gradle" which I can find in my File->Reopen Project list? Ubuntu 14.10 Android Studio 1.1 RC 1 Also affects open projects' list in Window menu: ...

Simple .BAT file rename issue

windows,batch-file,cmd,rename
Okay, so here's my issue. I have a program (program1) that when run looks for an INI file that has info about the user stored in it (userinfo.ini). The program does not support multiple users, so my idea is to have two INI files, one for user1 and another for...

Renaming files programatically, decrementing

c#,file,delete,rename
I have a folder with a certain number of text files named 1.txt, 2.txt 3.txt etc. My goal is that when one of them is deleted, to rename any of the files greater than the file deleted down one. Ex. if 1.txt is deleted, 2 should be renamed to 1,...

Renaming Playlist from MediaStore

android,rename,playlist,mediastore
I am trying to figure out how I can rename my playlist from the MediaStore. Below I have the code to delete a specific playlist by passing it the specified playlist ID. With content resolver there is a method called resolver.delete which makes it easy, but I don't seem to...

How to rename file forth and back in java

java,file,zip,rename,document
I want to rename a file name xxx.docx to xxx.docx.zip then rename it back to xxx.docx in Java. Here is my code. File file = new File(path); File file2 = new File(path+".zip"); file.renameTo(file2); File file3 = new File(file.getPath()); file2.renameTo(file3); It won't work. Thank you. Edit : The problem is I...

Android App Icon Shortcut Rename

android,rename,shortcut
Looking to change the name for an app (icon name) with established user base. Are there any issues that I should foresee that users can face when they download the update? Specifically worried about problems with launchers not updating the name of the icon properly of giving 'app does not...

Renaming with lists

bash,for-loop,rename
I have a set of files that I would like to rename by using new filenames stored in a txt file. My original files: 7170M 7172M 7187P 7192N 7198P I would like to add to each filename specific new names so that the above files become: 1956_26_7170M 1962_12_7172M 1989_32_7187P 1986_22_7192N...

numerate new versions of a file copied into a folder

powershell,copy,rename
I have a file that is generated daily. It is generated with the filename dailyfile.dat. The file needs to be copied into a destination folder and numerated with a single digit that is one higher than the file already in the destination folder so that all files coexist and have...

Using regular expression search and replace rename on linux with directory creation

regex,linux,replace,rename,mkdir
Take a list of files such as: /home/me/specialfiles/group01subgroup01.xyz /home/me/specialfiles/group01subgroup01.abc /home/me/specialfiles/group01subgroup01.nop /home/me/specialfiles/group01subgroup02.xyz /home/me/specialfiles/group01subgroup02.abc /home/me/specialfiles/group01subgroup02.nop /home/me/specialfiles/group01subgroup03.xyz /home/me/specialfiles/group01subgroup03.abc /home/me/specialfiles/group01subgroup03.nop /home/me/specialfiles/group01subgroup04.xyz /home/me/specialfiles/group01subgroup04.abc...

use rename command on first 5 characters of a file

linux,rename,bulk
using linux's rename utility I have files that are named similar to kbb.12.06.14.actual_name.jpg kbb.13.05.13.actual_name.jpg kbb.11.11.29.actual_name.jpg and I want to change that to actual_name.kbb.12.06.14.jpg actual_name.kbb.13.05.13.jpg actual_name.kbb.11.11.29.jpg I know I can get the beginning of a file with rename 's/^/something/' * but is there a way to select from the beginning to...

Capitalize all files in a directory using Bash

osx,bash,rename
I have a directory called "Theme_1" and I want to capitalize all the filenames starting with "theme". The first letter of every file name is lowercase and I want it to be upcase. I've tried this but all the letters in the filename are upcase, which is not what I...

Remove zeros inside file name

linux,bash,rename,mv
I have this file name 1006_12_000123123_000023126.data and I want this file name. I have arround 300000 files. 1006_12_123123_23126.png I tried som of these solution, but they are for filename like 00002323.jpg Linux command to remove leading zeros from a file name I can use mv to rename....

Weblogic 12c change domain name

dns,weblogic,rename
Does anyone know what is the correct way to change domain name in WLS 12c? After changed domain name i have this error: <2015-03-03 15:51:55 CET> <Critical> <JTA> <BEA-110482> <A logging last resource (LLR) failed during initialization. The server cannot boot unless all configured LLRs initialize. Failing reason: javax.transaction.SystemException: Failed...

After renaming xhtml pages, old file getting loaded in jsf

jsf,caching,jsf-2,xhtml,rename
I am having some kind of strange problem which i am not able to debug. Our application servers needs the downtime and hence we have built the temporary xhtml page for our website which will give the message that temporary servers down. Our plan is that during downtime we will...

How to use a csv file with oldvalue:newvalue to replace string inside files and filenames

csv,rename
We have a large number of rules files that carry one of >200 phonenumbers in their filename and/or reference the phonenumber in the file itself. Now most of these phonenumbers need to be changed so we have an input csv file that has a column for the old phonenumber and...

UIAlertView button text changing

swift,button,uialertview,rename
After choosing line from side menu, I'm calling alertView (for iOS7) with this code: var choiceAlert: UIAlertView = UIAlertView() choiceAlert.title = "Direction" choiceAlert.message = "Select a direction for no. \(lineNmb)." choiceAlert.addButtonWithTitle(dirA) choiceAlert.addButtonWithTitle(dirB) choiceAlert.addButtonWithTitle("Cancel") choiceAlert.delegate = self choiceAlert.tag = 3 choiceAlert.show() When I'm calling it for the first time, everything is...

rename images and move the renamed images in newly created directory

php,rename,mkdir
Here i want to create a new directory called c:/xampp/htdocs/haha/tour/ and in the directory i want to move my renamed images .Here ,i managed to create the new directory but can't move and rename my images.How can i solve this problem?? $dir='c:/xampp/htdocs/practice/haha'; $i=1; if(is_dir($dir)){ echo dirname($dir).'</br>'; $file=opendir($dir); while(($data=readdir($file))!==false){ if($data!='.' &&...

Copying multiple files into same directory while changing filename

file,powershell,copy,rename
I need to copy a series of files that look like foo.bar foo.baz foo.boo ... into the same director, but change the foo to moo. moo.bar moo.baz moo.boo ... But I'm not sure how I can copy and rename multiple files in one command. Something along the lines of cp...

Is it possible to change AppName in iTunesConnect before release (use a dummy name while in testflight phase)

itunesconnect,rename,testflight,bundle-identifier
I know this has been asked before, but testflight has recently been changed and adopted by apple, and now the app is required to be created through iTunesConnect. Now, is it possible to create an app with a dummy name for now, and change it later? An alternative solution could...

Trying to rename several account types at once based on current displayName

powershell,active-directory,user,rename,identity
This morning some awesome people helped me make a script to move user accounts based on their displayName to a certain OU. I tested and it worked. I cannibalized the script to make another one that will rename the same accounts based off of the same criteria. I've gone through...

Python program to rename file names while overwriting if there already is that file

python,python-2.7,rename,file-rename
As the title says, I wanted a python program that changes the file name, but I wanted to overwrite if there already is a file with that destination name. import os, sys original = sys.argv[1] output = sys.argv[2] os.rename(original, output) But my code just shows me this error when there...

Rename *.po to *.mo in Makefile

shell,makefile,translation,rename
I need to convert all the *.po translation files in the ./lang/ folder to *.mo files. In Makefile's "i18n" target, I have written: i18n: @for file in $(wildcard ./lang/*.po); do\ msgfmt $$file -o $(subst po,mo,$$file); \ done However, this code does not work; moreover, all the *.po files get damaged....

remove random text from file name

powershell,rename
I have a folder full of files which have had some text prepended to the filenames. For example: program1.m has become John Smith 23423_file_program1.m. program2.m has become Jane Doe 235_file_program2.m. The number of characters that have been prepended is not consistent, but the substring file_ is always the final set...

How does one rename multiple files within folders using python?

python,file,python-3.x,rename,file-rename
I have over 1000 folders in 'my documents'. In each folder there are only 4 photos that need to be named to 'North' 'East' 'South' and 'West' in that order. Currently they are named DSC_XXXX. I have written this script but it is not executing. import sys, os folder_list =...

php: Warning: rename The filename, directory name, or volume label syntax is incorrect. (code: 123)

php,rename
Since I am trying to copy my file I am getting this error, I am using windows 8.1 Warning: rename(../user/will/video/javascript-toggle-buttons-MonMar09122015-7491.mp4,../user/will/video/video-SunMar-15-18:03-2015-shared.mp4): The filename, directory name, or volume label syntax is incorrect. (code: 123) in E:\xampp\htdocs\social_media\root\php_parsers\status_system.php on line 353 this is I am trying to do, if (file_exists("../user/$author/$folder/$file")) { if (!file_exists("../user/$account_name/$folder")){...

Rename two columns in netezza using single query

table,rename,multiple-columns,netezza,alter
I am new to netezza. I need to know how can we rename two columns with a single query. I've tried , ALTER TABLE tabemp RENAME COLUMN salary to empsalary and name to empname; ALTER TABLE tabemp RENAME COLUMN salary to empsalary , name to empname; But none of these...

Name list elements based on variable names R

r,list,rename
I want to add elements to an empty list on the fly. Each element in the list should be named automatically after a set of variables which value will vary. However, I cannot seem to find a way to name list elements on the fly without getting errors. Consider the...

Batch: find files with specific content and extend existing name

batch-file,rename,findstr
I have about 100 .xml files, but its filenames are not self-explanatory. Therefore I would like to look for a specific word and extend the respecting file with this word. Thanks to some other helpful entries, I could partially figure out how to do this, but somehow the files are...

Bash Script to rename file inside a directory

bash,rename
I have a file named syscheck.sh in /system/0211/ and I want to rename it to checkone.sh. How can I do it?...

Changing the value of the download attribute of an anchor with javascript

javascript,html,download,rename
I want to change the value of the download attribute with javascript, I'm trying to use the download atribute of a <a> tag. But I dont know how to include javascript inside download? <a href="REALFILENAME.txt" download="JAVASCRIPT_FUNCTION_HERE">CLICK ME</a> function getDownloadName(){ return "REALFILENAME_" + new Date().getTime();+ ".txt"; } Thanks!...