rename

How to rename the files in the path with new different names in batch?

拥有回忆 提交于 2020-01-13 08:17:28
问题 I have one file destination.txt with path information about my CDs: C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SME99.ISO C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\Biomasse.iso C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SAMPE36.ISO Now I have to rename the ISOs with the numbers that are in the file PPN.txt one after another: 470692405 394006801 348117876 So it should be SME99.ISO -> 470692405.ISO Biomasse.iso -> 394006801.ISO Sampe36.ISO -> 348117876.ISO I have the

Python Edit/Rename Key Names in .json

丶灬走出姿态 提交于 2020-01-13 06:35:08
问题 Is there a way to change the Key name? I need to change the name "Class123" like it is in the Example. I can change the Value but i dont know how to change the key name. Example .json: { "Class123": "classvalue", "name1": { "name2": { "name3": { "Y": 158.8, "X": 201.46 }, "name4": { "Y": 159.68, "X": 200.32 } } } } Starting like this: with open('my.json') as json1: data = json.load(json1) for item in data: 回答1: There is no way to "change" a key name. The best you can do is to copy the value

rename folder into sub-folder with PHP

走远了吗. 提交于 2020-01-12 12:50:48
问题 I'm trying to move a folder by renaming it. Both the test1 and test2 folders already exist. rename( "test1", "test2/xxx1/xxx2" ); The error I get is: rename(...): No such file or directory I assume this is because the directory "xxx1" does not exist. How can I move the test1 directory anyway? 回答1: You might need to create the directory it is going into, e.g. $toName = "test2/xxx1/xxx2"; if (!is_dir(dirname($toName))) { mkdir(dirname($toName), 0777, true); } rename("test1", $toName); The third

Rails Paperclip S3 rename thousands of files?

无人久伴 提交于 2020-01-12 05:54:29
问题 I'm trying to rename a lot of files in s3--changing the current paperclip has_attached_file :path from stuff/:id_:updated_at_:style.:extension to stuff/:id_:counter_:style.:extension , where :counter is a field in the same model as the image. I haven't the foggiest on how to rename all the files--preferably in a rake task. Incidentally, I'll be incrementing :counter each time a new file is saved to the record. This is Rails 3 and the latest Paperclip as of this posting. Any ideas? Thanks! 回答1

How do I rename a project in Xcode?

不羁岁月 提交于 2020-01-11 12:22:56
问题 i have a finished application written with objective c and I would like to rename the file. how do i do that? 回答1: Recent versions of Xcode have a "Rename..." item in the Project menu. 回答2: Renaming a project has changed in Xcode 4+. (Kris Markel's answer above is for Xcode 3.2.x ) Follow these steps to rename your application in Xcode 4.0 or later: In Xcode, select your target under "Targets" in the project editor, then choose View > Utilities > Show File Inspector. Xcode opens the file

Bug in Python Renaming Program…No such file or Directory (Fnmatch)

拈花ヽ惹草 提交于 2020-01-10 03:21:53
问题 I'm trying to build a little renaming program to help save me time in the future. Basically it will go through directories I point it too and rename files if they meet certain criteria. I have written what I need but I have a bug in the very beginning that I can't figure out. Here is the code: import os import fnmatch for file in os.listdir("""/Users/Desktop/TESTME"""): if fnmatch.fnmatch(file,'MISC*'): os.rename(file, file[4:12] + '-13-Misc.jpg') When I try to run it I am getting this:

How to change name of factor levels?

▼魔方 西西 提交于 2020-01-09 11:04:31
问题 training set trainSample <- cbind(data[1:980,1], data[1:980,2]) cl <- factor(c(data[1:980,3])) test set testSample <- data(data[981:1485,1], data[981:1485,2]) cl.test <- clknn prediction k <- knn(trainSample, testSample, cl, k = 5) output < k [1] 2 2 1 1 1 1 2 1 2 1 1 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 1 1 2 2 1 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 [60] 2 2 2 2 1 2 2 2 2 1 2 2 1 2 2 2 1 1 2 1 2 2 1 1 1 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 [119] 2 2

Recursively renaming files with Powershell

孤者浪人 提交于 2020-01-09 06:48:00
问题 I currently have a line to batch rename files in a folder that I am currently in. dir | foreach { move-item -literal $_ $_.name.replace(".mkv.mp4",".mp4") } This code works perfectly for whatever directory I'm currently in, but what I want is to run a script from a parent folder which contains 11 child-folders. I can accomplish my task by navigating to each folder individually, but I'd rather run the script once and be done with it. I tried the following: get-childitem -recurse | foreach {

Recursively renaming files with Powershell

流过昼夜 提交于 2020-01-09 06:47:07
问题 I currently have a line to batch rename files in a folder that I am currently in. dir | foreach { move-item -literal $_ $_.name.replace(".mkv.mp4",".mp4") } This code works perfectly for whatever directory I'm currently in, but what I want is to run a script from a parent folder which contains 11 child-folders. I can accomplish my task by navigating to each folder individually, but I'd rather run the script once and be done with it. I tried the following: get-childitem -recurse | foreach {

Rename uploaded files

南笙酒味 提交于 2020-01-07 07:07:11
问题 I am uploading files via php. The amount of files can be uploaded is determined by a value which is stored in database. So let's say, this value is 3, than my code show three html file input. This is working. I could also rename one file too. working extension filter, and size restrictions.. But when I tried to do this with more than one, I stacked... The new name should be the 'number of list element'-'base filename'. Example: 1-thisisanimage.jpg 2-anotherimage.jpg 3-andthisalso.jpg I tried