renaming

rename file with progressive enumeration

送分小仙女□ 提交于 2019-12-25 16:45:28
问题 I have a file called mycat.avi inside a folder VIDEO so that the path is c:\video\mycat.avi now I would like rename it so that the new re-name become start from C0700.mxf IF in folder c:\video is jet present another C0700.mxf -----> the file have to renamed C0701.mxf if in folder c:\video is jet present another C0701.mxf -----> the file have to renamed C0702.mxf if in folder c:\video is jet present another C0702.mxf -----> the file have to renamed C0703.mxf ... and so on Supposing mycat.avi

renaming files using variables in Ruby

只愿长相守 提交于 2019-12-25 05:10:34
问题 How do you use variables to rename files in Ruby? File.rename("text1.txt", "text2.txt") The above example is fine when using irb, but I writing a script where both var1 and var2 are unknown to me. for example: script_dir = File.expand_path File.dirname(__FILE__) Dir.chdir(script_dir) Dir.glob('Cancer1-1.pencast').each do |pencast| pencast_title = File.basename(File.basename(pencast), '.*') i = 1 audio_title = File.basename(`unzip -l #{pencast} | grep .aac | awk '{print $4;}' | awk 'NR=='#{i}'

How to bulk rename files within subfolders - using CMD command prompt

十年热恋 提交于 2019-12-25 03:57:06
问题 I am quite new to Command Prompt (Windows), however I have used it to do some file extensions changing and it is extremely helpful. I know nothing on coding, and so i am simply going off what I have read about but I am looking for a command line that I cant seem to find anywhere. I have folder, and inside that folder are 70 sub folders each labelled by a number from 1-70. Inside these subfolders are roughly 20 png picture files, that are currently numbered by a number from 1-20 in png format.

Bat to Prefix File names with folder characters & suffix with date

你。 提交于 2019-12-25 03:52:43
问题 I'm a complete newbie when it comes to bat/cmd stuff. I can do the very very basics with a little help from google! & when i mean basic im talking xcopy, robocopy etc. I am trying to write a code that will extract the 1st 5 characters from the current folder & rename files within a subfolder but also suffix with the current date. So this is basically what im trying to do. W:\12345_folder This is the main folder that I want to extract the 12345 from. W:\12345_folder\subfolder This is the

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%

Renaming a range from files w/Powershell - from first to third from last hyphen

瘦欲@ 提交于 2019-12-24 09:15:32
问题 I have a bunch of csv files I would like to rename with powershell. from abc-def-ghi-jkl-mno-pqr-ke-traffic-by-domains-17-Oct-2018_23-49-38-6d73395f476ad09a7506dc00533933b8.csv abc-def-ghi-jkl-mno-pqr-ke-traffic-by-domains-15-Oct-2018_05-20-36-75eabae7c4123198ff5fe6f4f642449f.csv abc-def-ghi-jkl-mno-pqr-ke-traffic-by-domains-12-Oct-2018_06-23-58-b13eb8f362c09fbe405458fac8af8f8e.csv to abc-17-Oct-2018.csv abc-15-Oct-2018.csv abc-12-Oct-2018.csv I could delete the characters after the

git added by them renaming conflict - git recognises the same files in the renamed directory as new files

被刻印的时光 ゝ 提交于 2019-12-23 04:04:35
问题 I've renamed a directory and merged it into my main branch, when merging another branch, git recognises the same files in the renamed directory as new files. I get the merge conflict 'added by them' for the same files in that directory when merging in another's branch: added by them: theirDir/same_file_name.xxx I've renamed the directory in their branch to match and continue to get the 'added by them' conflict. When I try to checkout --ours I get $ git checkout dir/same_file_name.xxx --ours

Copy file names from one folder to another while keeping the original extensions

雨燕双飞 提交于 2019-12-23 00:41:50
问题 I need help with copying file names (not the files themselves) from C drive to D drive. I was able to find the following powershell code online: $names = @() $getPath = "C:\MyFiles" $setPath = "D:\MyFiles" Get-ChildItem $getPath | Foreach-object{ $names += $_ } $i = 0 Get-ChildItem $setPath | Foreach-object{ Rename-Item -Path $_.FullName -NewName $names[$i] $i++ } This code successfully renames/copies all file names from C:\MyFiles to D:\MyFiles , strictly by corresponding positions (indices

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"

Rename all files in a folder using batch

て烟熏妆下的殇ゞ 提交于 2019-12-20 07:37:09
问题 I would like to create a batch file to rename all the files with extension ".log" in a folder to append with today's date. For example : App.log will be appended to App.log06112010 where date is 06112010. Please suggest 回答1: forfiles /m *.log /c "cmd /c ren @file @file06112010" 回答2: #!/usr/bin/ksh export TODAYSDATE=`date "+%m%d%Y"` umask 000 for filename in $1 do if [ ! -f $1 ]; then echo "$filename doesn't exist!" else if [ -d $1 ]; then echo "Skipping directory $filename..." else mv