rename

Powershell foreach with path not finding files

删除回忆录丶 提交于 2019-12-11 04:07:09
问题 I'm trying to rename files in a specific directory by my foreach block isn't finding any files. #expected encountered filename = 3000 Miles To Graceland 2001.avi $path = "D:\Media Holding\[UsaBit.com]_3000 Miles To Graceland 2001" foreach($file in Get-ChildItem $path) { "FOUND ITEM" if (!$file.PSIsContainer) { $fileName = $file.FullName -replace ("(\w.*?)([12]\d{3})", "$1 ($2)") -replace("\.", " ") -replace("\s{2,}", " ") $fileExtension = $file.FullName -replace ("[^\.]*\.(\w{3,4})$", ".$1")

Can't rename directory in C# but manually

徘徊边缘 提交于 2019-12-11 03:34:18
问题 I'm using Directory.Move(oldDir, newDir) to rename a directory. Every now and then I get a IOException saying "Access to the path "oldDir" is denied" . However if I right click the directory in the explorer I can rename it without any issues. How's that and how can I get it to work? EDIT The program is still running, I get the exception and can rename it manually while my cursor is paused on the breakpoint. I also tried setting a breakpoint at Directory.Move , successfully renamed the

remove date from filename but keep the file extension

对着背影说爱祢 提交于 2019-12-11 03:15:43
问题 I have files like these in a directory called current_dir: my data-file 2014-10.txt data file201409.txt and I want my data-file.txt data file.txt Here is what I tried rename 's/ *[0-9]{4}-?[0-9]{2}.*$//' current_dir/*.txt but it removed the .txt extension as well. I'm quite new to linux, could anyone help me? 回答1: rename only replaces the matched part so removing .*$ from the regular expression keeps the .txt rename 's/ *[0-9]{4}-?[0-9]{2}//' current_dir/*.txt Examples $ rename -n 's/ *[0-9]

Stop eclipse renaming inside strings

大憨熊 提交于 2019-12-11 02:54:17
问题 I've been having this problem for some time and have never bothered to fix it since Eclipse has a horrible help system and I can't seem to find the right Google keywords to find what I need. My problem is that when I refactor a class name, eclipse looks for all potential locations of that name and replaces them. For instance, if I have a string inside a test case for the "list command" that says something like, "List - list all the users on a team", when I refactor the List.java class to

Gradle zip: how to include and rename one file easily?

末鹿安然 提交于 2019-12-11 01:29:38
问题 Create a zip adding file "hello/world.xml" under directory "foo/bar" as "hello/universe.xml" task myZip(type: Zip) { from ("foo/bar") { include "hello/world.xml" filesMatching("hello/*") { it.path = "hello/universe.xml" } } } filesMatching(...) will impact performance obviously. What is a better way? like: task myZip(type: Zip) { from ("foo/bar") { include ("hello/world.xml") { rename "hello/universe.xml" } } } But rename is not supported with include . 回答1: I don't get why you are using

Underscore in rename command (Perl and Unix shell)

丶灬走出姿态 提交于 2019-12-11 00:53:51
问题 I'm trying to replace all _ underscore character by - hyphen character in all file names .mat inside one folder. I type different versions unsuccessfully of: rename -f 'w/_/-' *.mat Can someone explain to me what is wrong? 回答1: If you're using a Perl-based rename (as your tags suggest) then w isn't a Perl regex operation. rename -f 's/_/-/g' *_*.mat 回答2: I cannot fathom whether you are using a shell rename or the Perl rename: I can't understand your command in either context. A Perl command

command line bulk rename

只愿长相守 提交于 2019-12-11 00:51:55
问题 I have files in multiple subfolders, I want to move them all to one folder. Then I like to rename those files. /foo/A1000-foobar1412.jpg /foo/A1000-foobar213.jpg /foo/A1000-foobar314.jpg /foo1/B1001-foobar113.jpg /foo2/C1002-foobar1123.jpg /foo2/C1002-foobar24234.jpg What I would like to get is: ../bar/A1000-1.jpg ../bar/A1000-2.jpg ../bar/A1000-3.jpg ../bar/B1001-1.jpg ../bar/C1002-1.jpg ../bar/C1002-2.jpg So what I do so far is: find . -name "*.jpg" -exec mv {} ../bar/ \; But now I'm stuck

Matlab: renaming workspace elements from command window?

自作多情 提交于 2019-12-11 00:04:03
问题 The GUI of Matlab allows me to rename any element in the workspace by right-clicking on the element and selecting the 'rename' option. Is it possible to do this from the command window as well? 回答1: These are things you can easily test for yourself, and you should do so. That is the best way to learn, to discover. Regardless, the answer is no, you cannot change a variable name in that way from the command window. The command window is mainly for keyboard input only. Edit: The question was

rename column names dynamically in dplyr chain [duplicate]

别说谁变了你拦得住时间么 提交于 2019-12-10 23:53:14
问题 This question already has an answer here : Rename multiple columns given character vectors of column names and replacement [duplicate] (1 answer) Closed 2 years ago . Here's an example temp <- mtcars colnames(temp)[grepl("ge", colnames(temp))] <- "garbage" Output mpg cyl disp hp drat wt qsec vs am garbage carb Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258

Pandas rename columns with wildcard

半城伤御伤魂 提交于 2019-12-10 23:14:35
问题 My df looks like this: Datum Zeit Temperatur[°C] Luftdruck Windgeschwindigkeit[m/s] Windrichtung[Grad] Relative Luftfeuchtigkeit[%] Globalstrahlung[W/m²] Now i want to rename the columns like this:# wetterdaten.rename(columns={'Temperatur%': 'Temperatur', 'Luftdruck[hPa]': 'Luftdruck'}, inplace=True) Where % is a wildcard. But of course it will not work like this. The beginning of the column name is always the same in the log data, but the ending is temporally changing. 回答1: You can filter