file-rename

Using Powershell to reverse the sequence numbers in a set of file names

ε祈祈猫儿з 提交于 2020-01-03 19:35:14
问题 I am new to using PowerShell (and coding for that matter), all I'm trying to do is rename my files). I have 222 .jpg's that are named "REF_10001.jpg" "REF_10002.jpg" "REF_10003.jpg" etc but my problem is that they are in the wrong order, I need to reverse them, for example I need "REF_10001.jpg" --> "REF_10222.jpg" and vice versa. "REF_10222.jpg" --> "REF_10001.jpg" Is there a way to do this? I have been struggling for hours to rename my files properly, just to realize they are in the wrong

Find characters and rename file name using Powershell

孤者浪人 提交于 2020-01-02 07:34:20
问题 I have a large number of files in a directory with this type of naming convention: "1050_14447_Letter Extension.pdf", etc. I need to remove all characters before the 2nd underscore (including the 2nd underscore). So the new file name would be "Letter Extension.pdf". How can I iterate the single directory renaming accordingly? 回答1: Here's an example to rename all pdf files in the current directory, removing all leading numbers or underscores from the file name: Get-ChildItem -Filter *.pdf |

How to change file extension at runtime in Java

三世轮回 提交于 2019-12-28 17:56:17
问题 I am trying to implement program to zip and unzip a file. All I want to do is to zip a file (fileName.fileExtension) with name as fileName.zip and on unzipping change it again to fileName.fileExtension . 回答1: Try with: File file = new File("fileName.zip"); // handler to your ZIP file File file2 = new File("fileName.fileExtension"); // destination dir of your file boolean success = file.renameTo(file2); if (success) { // File has been renamed } 回答2: This is how I used to rename files or change

Removing part of filename with batch

こ雲淡風輕ζ 提交于 2019-12-25 18:13:54
问题 I've tried to tweak a lot of the code provided to similar questions, but I don't think the solution is posted. My problem is that the part from where I want to remove the rest exists 2 times before the last! What I have is a folder with: number1-number2-number3 - some random text about the file.filetype number1 will range from 01 to 99 number2 will range from 1-99999 number3 will range from 1-999 with the possibility of 2 decimals, separated from whole number by . Example folder c:\temp\ : 15

Removing part of filename with batch

荒凉一梦 提交于 2019-12-25 18:12:09
问题 I've tried to tweak a lot of the code provided to similar questions, but I don't think the solution is posted. My problem is that the part from where I want to remove the rest exists 2 times before the last! What I have is a folder with: number1-number2-number3 - some random text about the file.filetype number1 will range from 01 to 99 number2 will range from 1-99999 number3 will range from 1-999 with the possibility of 2 decimals, separated from whole number by . Example folder c:\temp\ : 15

Rename method of Ruby; escaping colon

那年仲夏 提交于 2019-12-25 08:05:09
问题 How do you escape a colon, when renaming files in Ruby? I have following code (names is a hash with data already filled in): new_filename = "" counter = 0 Dir.glob(folder_path + "/*").each do |f| numbering = names.index(names.values.sort[counter]) new_filename = numbering + " - " + names.values.sort[counter] puts "New file name: " + new_filename File.rename(f, folder_path + "/" + new_filename + File.extname(f)) counter += 1 end puts "Renaming complete." The output of new_filename is correct,

Sharepoint online - Powershell - Rename\Move file

谁都会走 提交于 2019-12-25 03:00:55
问题 We are using online share point as part of our office 365 (my scripts are not running from the sharepoint server itself). I want to rename\Move files in the share point after i finish up processing them. I found a way to download the file to my pc but i cant seem to find the way to rename the file or move it to a different directory in the site. Environment : Sharepoint online Powershell : Powershell 3.0 i am using the following code to get the list of items `$ctx = New-Object Microsoft

Renaming a group of files, at the same time, using a regex to concatenate a number before their extension - Python or Batch Script

浪子不回头ぞ 提交于 2019-12-24 10:15:29
问题 I want to rename each file that ends in .log, but I have similar files like: x.log x01.log y.log y01.log .... I want to rename every file, at a time, with that extension (.*) but without any number, i.e., I want to rename x.log to xN.log, y.log to yNlog, z.log to zN.log, in which N is the number I want to concatenate. Is this possible in a Windows batch script using a regex or even Python? Anything will do, as long as I can give the parameter N. 回答1: SET ext=.log SET num=%1 FOR %%f IN (*%ext%

Subversion: Can I tell the conflict resolver, to look for structural changes not on the incomig, but on the local files?

岁酱吖の 提交于 2019-12-24 07:17:09
问题 Note: The underlying situation of this question is also part of a slightly different question here. Situation I have a trunk, where earlier, a branch has been made from. Then, in the trunk some file renamings have been made. These renamings were accidentially made by "copy/delete", not with the proper svn rename process as they should have. This is described in the TSVN docs, and in my case the "Repair move" was omitted. Now I have tree conflicts, when merging the branch back to the trunk:

How to rename file with a sequence that restarts if certain matches exist

拟墨画扇 提交于 2019-12-24 01:00:00
问题 That title doesn't explain much but I couldn't summarize it quickly. Let's say I have files like this (all in the same directory)... abc_foo_file1_morestuff.ext abc_foo_file2_morestuff.ext efg_goo_file1_morestuff.ext jkl_zoo_file0_morestuff.ext jkl_zoo_file1_morestuff.ext jkl_zoo_file4_morestuff.ext xyz_roo_file6_morestuff.ext And I want them renamed to: abc-1.ext abc-2.ext efg-1.ext jkl-1.ext jkl-2.ext jkl-3.ext xyz-1.ext So basically some files in sets (abc, jkl, xyz) got removed and some