batch-rename

batch renaming files using powershell

房东的猫 提交于 2021-02-17 06:47:08
问题 I am able to batch rename files in a working directory by using: Dir | %{Rename-Item $_ -NewName ("0{0}.wav" -f $nr++)} However I want the file rename to start at something other than zero. Say 0500, and rename sequentially in order. Dir | %{Rename-Item $_ -NewName ("0{500}.wav" -f $nr++)} returns error. How can I tell rename to start at a number other than 0? 回答1: You can initialize the counter beforehand to 500. Also, you don't need to use a ForEach-Object loop ( % ) for this, because the

Batch renaming files after certain character

只谈情不闲聊 提交于 2021-02-11 04:52:37
问题 I have a bunch of video files with names like so: 6592110904-Ivory-2.mp4 6592280588-Cornflower.mp4 6592321696-Ballet Pink.mp4 I want to rename them to get rid of everything after the first hyphen so they end up like: 6592110904.mp4 6592280588.mp4 6592321696.mp4 How do I go about doing this? 回答1: Please put the code below in a bat file, place it in directory with mp4 files. Before running real renaming, please remove "echo" before "move". please be carefull with renaming bacause (theoretically

Batch renaming files after certain character

限于喜欢 提交于 2021-02-11 04:52:13
问题 I have a bunch of video files with names like so: 6592110904-Ivory-2.mp4 6592280588-Cornflower.mp4 6592321696-Ballet Pink.mp4 I want to rename them to get rid of everything after the first hyphen so they end up like: 6592110904.mp4 6592280588.mp4 6592321696.mp4 How do I go about doing this? 回答1: Please put the code below in a bat file, place it in directory with mp4 files. Before running real renaming, please remove "echo" before "move". please be carefull with renaming bacause (theoretically

Perform multiple search-and-replaces on the colnames of a dataframe

天涯浪子 提交于 2021-01-27 13:20:46
问题 I have a dataframe with 95 cols and want to batch-rename a lot of them with simple regexes, like the snippet at bottom, there are ~30 such lines. Any other columns which don't match the search regex must be left untouched. **** Example: names(tr) = c('foo', 'bar', 'xxx_14', 'xxx_2001', 'yyy_76', 'baz', 'zzz_22', ...) **** I started out with a wall of 25 gsub()s - crude but effective: names(tr) <- gsub('_1$', '_R', names(tr)) names(tr) <- gsub('_14$', '_I', names(tr)) names(tr) <- gsub('_22$',

batch copy/move files to folders with same name

青春壹個敷衍的年華 提交于 2020-07-23 04:45:05
问题 I have a bunch of .xlsx files that are generated every month. I would like to be able to batch move the files to folders which have basically the same name. Example: 123456 Action.xlsx, 123456 RC.xlsx, 123456 PF.xlsx would be the files. The folder would be 123456 Random Center. Is there a way to move those files to that folder using a batch command or something else through the command prompt? Here is the the code I have been trying to use/modify. @echo off pushd "C:\New folder" rem Process

batch copy/move files to folders with same name

心已入冬 提交于 2020-07-23 04:44:17
问题 I have a bunch of .xlsx files that are generated every month. I would like to be able to batch move the files to folders which have basically the same name. Example: 123456 Action.xlsx, 123456 RC.xlsx, 123456 PF.xlsx would be the files. The folder would be 123456 Random Center. Is there a way to move those files to that folder using a batch command or something else through the command prompt? Here is the the code I have been trying to use/modify. @echo off pushd "C:\New folder" rem Process

batch copy/move files to folders with same name

99封情书 提交于 2020-07-23 04:43:05
问题 I have a bunch of .xlsx files that are generated every month. I would like to be able to batch move the files to folders which have basically the same name. Example: 123456 Action.xlsx, 123456 RC.xlsx, 123456 PF.xlsx would be the files. The folder would be 123456 Random Center. Is there a way to move those files to that folder using a batch command or something else through the command prompt? Here is the the code I have been trying to use/modify. @echo off pushd "C:\New folder" rem Process

Batch rename all files in a directory to basename-sequentialnumber.extention

别说谁变了你拦得住时间么 提交于 2020-06-16 17:27:48
问题 I have a directory containing .jpg files, currently named photo-1.jpg , photo-2.jpg etc. There are about 20,000 of these files, sequentially numbered. Sometimes I delete some of these files, which creates gaps in the file naming convention. Can you guys help me with a bash script that would sequentially rename all the files in the directory to eliminate the gaps? I have found many posts about renaming files and tried a bunch of things, but can't quite get exactly what I'm looking for. For