rename

Rename files to increment filenumber using PowerShell?

旧巷老猫 提交于 2019-12-22 17:49:13
问题 I've got a bunch of files named attachment.023940 attachment.024039 attachment.024041 attachment.024103 etc... I need to rename the files by incrementing the filenumber by a given number. (So that they match the right ID in a database) I guess I could write a C# application that uses RegEx to parse the filename, but I assume this is a task that could be accomplished in PowerShell as well? I've found several other threads on SO about using PowerShell to rename files, but none of them handled

rename each file with new-guid in powershell

天涯浪子 提交于 2019-12-22 12:45:10
问题 I have been trying to rename each txt file in a folder with the filename $New-Guid .txt, so they should all have unique names. Anyone know the simple way to do this? 回答1: tl;dr Get-ChildItem ... | Rename-Item -NewName { "$(New-Guid).txt" } Note the use of a script block ( { ... } ) and the call to New-Guid inside $(...) embedded in an expandable string ("..."). File renaming / moving operations with multiple input files are most efficiently performed with delay-bind script blocks , where a

In log4j2, how to configure renameEmptyFiles to be false for the RollingFile appender?

空扰寡人 提交于 2019-12-22 12:39:09
问题 I'm using log4j 2 and RollingFile appender: <RollingFile name="mylog" fileName="mylog.log" filePattern="mylog.log.%d{yyyy-MM-dd}.log"> <PatternLayout> <pattern>[%d] [%-5p] [%-8t] %F:%L %m%n</pattern> </PatternLayout> <Policies> <TimeBasedTriggeringPolicy interval="1"/> </Policies> </RollingFile> The log files do get renamed daily. But the Javadoc of FileRenameAction class indicates there is an option renameEmptyFiles which is false by default so if a day's log is empty it deletes it instead

Rename multiple files from command line [duplicate]

落爺英雄遲暮 提交于 2019-12-22 10:45:13
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Renaming lots of files in Linux according to a pattern I have multiple files in this format: file_1.pdf file_2.pdf ... file_100.pdf My question is how can I rename all files, that look like this: file_001.pdf file_002.pdf ... file_100.pdf I know you can rename multiple files with 'rename', but I don't know how to do this in this case. 回答1: You can do this using the Perl tool rename from the shell prompt. (There

Weird behaviour in PowerShell bulk file renaming

巧了我就是萌 提交于 2019-12-22 08:37:10
问题 I'm new to PowerShell and recently I try to rename 120 files in a folder and I encounter a weird behavior. What I have is files with named from 0001.txt, 0002.txt, ... 0120.txt a total of 120 files. I want to add an 'a' in front of each of the file name. I came up with this command: ls | ren -newname {$_.name -replace '(\d+)','a$1'} But after execution, I get numerous error like this: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260"

How to use mv command to rename multiple files in unix?

余生颓废 提交于 2019-12-22 06:08:07
问题 I am trying to rename multiple files with extension xyz[n] to extension xyz example : mv *.xyz[1] to *.xyz but the error is coming as - " *.xyz No such file or directory" 回答1: Don't know if mv can directly work using * but this would work find ./ -name "*.xyz\[*\]" | while read line do mv "$line" ${line%.*}.xyz done 回答2: Let's say we have some files as shown below.Now i want remove the part -(ab...) from those files. > ls -1 foo* foo-bar-(ab-4529111094).txt foo-bar-foo-bar-(ab-189534).txt foo

Python File Creation Date & Rename - Request for Critique

橙三吉。 提交于 2019-12-22 05:41:47
问题 Scenario: When I photograph an object, I take multiple images, from several angles. Multiplied by the number of objects I "shoot", I can generate a large number of images. Problem: Camera generates images identified as, 'DSCN100001', 'DSCN100002", etc. Cryptic. I put together a script that will prompt for directory specification (Windows), as well as a "Prefix". The script reads the file's creation date and time, and rename the file accordingly. The prefix will be added to the front of the

Rename class members by inheriting class in C++

元气小坏坏 提交于 2019-12-22 05:19:22
问题 I would like to "rename" some members of my class ofVec4f . I know it's impossible in strict C++ but could I create a new class that inherits from my class and declare new members which are aliases or pointers to the original members? I tried the following: class ofVec4fGraph : public ofVec4f { public : float& minX; float& maxX; float& minY; float& maxY; ofVec4fGraph(float _minX,float _maxX, float _minY, float _maxY ) : minX(_minX), maxX(_maxX), minY(_minY), maxY(_maxY) { ofVec4f(_minX, _maxX

Attempted Frozen Title Change: Any FB developers?

不想你离开。 提交于 2019-12-21 07:57:32
问题 This has been asked a few times over the past couple of years but as Facebook tells me "Facebook engineers actively participate on StackOverflow.." So I'm hoping get get some joy here. We have uploaded a video to youtube, passed it round and made sure we are happy with it, made it public and tried to change the title from 'xxx - final' to the actual title. However, Facebook shares are showing the old prerelease title but not the actual title, leading to much confusion amongst our subscribers

Attempted Frozen Title Change: Any FB developers?

ぐ巨炮叔叔 提交于 2019-12-21 07:57:09
问题 This has been asked a few times over the past couple of years but as Facebook tells me "Facebook engineers actively participate on StackOverflow.." So I'm hoping get get some joy here. We have uploaded a video to youtube, passed it round and made sure we are happy with it, made it public and tried to change the title from 'xxx - final' to the actual title. However, Facebook shares are showing the old prerelease title but not the actual title, leading to much confusion amongst our subscribers