rename

batch rename files with ids intact

只谈情不闲聊 提交于 2019-12-20 03:49:12
问题 i have a directory listing like seascaperecovered0088crop.jpg seascaperecovered0096crop.jpg seascaperecovered0098crop.jpg seascaperecovered0101crop.jpg seascaperecovered0103crop.jpg seascaperecovered0105crop.jpg seascaperecovered0107crop.jpg seascaperecovered0112crop.jpg seascaperecovered0119crop.jpg seascaperecovered0122crop.jpg and i want to rename all files as seen here: seascape_0122.jpg i have tried something like this: for f in `ls | egrep 'seascaperecovered.*\.jpg'`; do mv $f ${f

Java File.renameTo(File) not working

怎甘沉沦 提交于 2019-12-20 03:33:55
问题 I'm trying to list a directory's contents, and rename certain files. public void run(String dirName) { try { File parDir = new File(dirName); File[] dirContents = parDir.listFiles(); // Rename if necessary for(File f : dirContents) { System.out.println("f is:\n" + f.toString()); String name = f.getName(); String subbedName = name.replaceAll("\uFFFD", "_"); System.out.println("\n" + "name = " + name + ", subbedName = " + subbedName + "\n"); if(!name.equals(subbedName)) { File newFile = new

Replace square bracket using Powershell

橙三吉。 提交于 2019-12-19 21:22:30
问题 If you have a filename such as "Committee minutes [October 2010] - hq.doc", how do you get Powershell to replace the square brackets? The following doesn't work: ls -filter *`[*`]* | foreach -Process { Rename-Item $_ -NewName ($_.Name -replace '\[', '\(') | Rename-Item $_ -NewName ($_.Name -replace '\]', '\)')} I get the error: Rename-Item : Cannot rename because item at 'Committee minutes [October 2010] - hq.doc' does not exist. At line:1 char:53 + ls -filter *`[*`]* | foreach -Process {

Name list elements based on variable names R

谁说胖子不能爱 提交于 2019-12-19 20:10:53
问题 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 example below: L <- list() var1 <- "wood" var2 <- 1.0 var3 <- "z4" varname <- paste(var1, as.character(var2), var3, sep="_") # This works fine: L$"wood_1_z4" <- c(0,1) L$"wood_1_z4" 0 1 # This doesn't!! L$paste(var1, as.character(var2)

Name list elements based on variable names R

你说的曾经没有我的故事 提交于 2019-12-19 20:07:12
问题 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 example below: L <- list() var1 <- "wood" var2 <- 1.0 var3 <- "z4" varname <- paste(var1, as.character(var2), var3, sep="_") # This works fine: L$"wood_1_z4" <- c(0,1) L$"wood_1_z4" 0 1 # This doesn't!! L$paste(var1, as.character(var2)

Moving multiple files with same name and renaming them on the fly

爷,独闯天下 提交于 2019-12-19 10:56:21
问题 I have multiple folders in my ubuntu 16.04 with pictures in them. I would like to move all pictures to one folder and rename all files with same name. I can easily move pictures from first folder, but how do i copy pictures from rest of the folders without destroying (copying over) all existing files with same name? Is there some handy oneliner that i could use in terminal for this? 回答1: cp has a useful option --backup=numbered that adds a numbered suffix to the name of a file that would

PHP rename failed for filename with utf-8 arabic charset string

a 夏天 提交于 2019-12-19 10:53:44
问题 I have an issue with php rename function, it fail if file name is in Arabic words with spaces. e.g. rename(temp/أم كلثوم ثوار - ثوار.mp3,audio/13408831061.mp3); No such file or directory in (path) please note: أم كلثومxxxxxxxxثوار - ثوار.mp3 xxxxxxx here atleast six spaces. I tried urlencode() but still no result. Any suggestion! 回答1: To check that your $file_id is correct, do this on a Unix-like system: echo "<pre>\n"; // for HTML output only system("echo -n '$file_id' | od -tx1"); With this

git change default branch (gitolite)

北慕城南 提交于 2019-12-19 09:50:02
问题 I've got a repository with branches: master and devel. Master is the default one. I want to rename master into prod and make it default (and push it to the server). How to do this? Repository is hosted in gitolite (if it matters). 回答1: You need to have access to the server in order to change the symbolic-ref of HEAD to the branch you have pushed there ( prod ). git-symbolic-ref HEAD refs/head/prod I tentatively proposed a way to do that from a client at the end of "How do I change a Git

Ruby to rename files

血红的双手。 提交于 2019-12-19 09:20:21
问题 I have a script that renames files from a .csv file, this file works fine but am looking to edit it a little bit more so that it help me even more. The scenario is I have 8,000 images that have a CID code some of them have the CID code some of them have extra text with it and are multiple images under the same CID ID i.e 17263.jpg 17263a.jpg , 17623b.jpg , I then need to rename the CID images with product codes to work on a website, as well as adding the relevant a or b or c letter after it,

Changing sheet codename Run-Time Error 9: Subscript out of range

强颜欢笑 提交于 2019-12-19 05:45:12
问题 I've code which, when I press a button, will add a new sheet to a workbook and change the codename of the sheet to make it easier to refer to later in my code. Dim wbk As Workbook Dim wks As Worksheet Set wbk = ThisWorkbook wbk.Sheets.Add.Name = "Admin - Save Log" Set wks = wbk.Worksheets("Admin - Save Log") wks.Parent.VBProject.VBComponents(wks.CodeName).Name = "wksAdminSaveLog" This does work - HOWEVER - only when I have the "Developer" window open or have previously had it open. If I click