batch-rename

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

耗尽温柔 提交于 2020-06-16 17:27:39
问题 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

Command Prompt/Batch - rename multiple files with sequential numbering

放肆的年华 提交于 2020-05-14 22:04:06
问题 Lets say I have multiple files filename.a.txt filename.b.txt filename.c.txt I want to run a batch file that targets all .txt files and rename them to whatever I have set into my custom %filename% var + give them numbers so it would end up into something like: filename.1.txt filename.2.txt filename.3.txt So far I have wrote this: set filename=FileTitle for /r %%i in (*.txt) do call ren %%i %filename%.txt And it works, but problem is that it just picks up first .txt file and gives it the

Renaming pdf files with a batch file

假如想象 提交于 2020-03-05 06:13:50
问题 I need to either write a batch file or a vbscript that will rename files. I need to keep everything in the file name up to the second "." but delete what comes after the second dot. This is a sample of what the file names look like: nnnnnnnnnnnnnnnn.xxxxxxxx.dddddddddd.pdf n = 16 numbers 0-9 x = date in this format ex:02232008 d = 10 numbers 0-9, this is the part of the file name that I want to delete . I need the d's from the sample above to be deleted but keep the rest of the file name the

.bat for batch rename to increment numbers in fname

北慕城南 提交于 2020-01-29 21:37:08
问题 I have a large folder of .cbr's, and I'm renaming them by issue number to correctly order them. What do I need to include in the ren line to have each file increment the number in the file name via windows command prompt? I'll be doing this frequently so I'll make this a .bat file. For example, where n = initial number and m = final number: n.cbr, (n+1).cbr, ..., (m-1).cbr, m.cbr The .bat thusfar: ren *.cbz *.cbr ren *.cbr <increment numbers n through m>.cbr Alternatively, how do I trim each

Batch file renaming: How to preserve the order of filename?

∥☆過路亽.° 提交于 2020-01-24 21:59:24
问题 I have 1000 images that I want to rename them from 1 to 1000. I found this solution (the most voted answer): dirData = dir('*.png'); %# Get the selected file data fileNames = {dirData.name}; %# Create a cell array of file names for iFile = 1:numel(fileNames) %# Loop over the file names newName = sprintf('%04d.png',iFile); %# Make the new name movefile(fileNames{iFile},newName); %# Rename the file end But it falls short when the number of digits from the original file name changes.

batch search and replace folders names

断了今生、忘了曾经 提交于 2020-01-06 08:17:08
问题 i'm using batch file (named as folder.bat) to add the string "_v0_1" for each foler name under "my folder" (i have about 100 folders under "my folder") I'm calling my batch (folder.bat) from a onother batch file that contains this rows(for example): call folder arbiter_logic call folder arbiter_logic_old the problem, is that the batch rename folders also when the folder name is longer than the variable name (%1) and i want to avoid it . I want that the renaming action will execute only if

search and replace file names - bug fix

天大地大妈咪最大 提交于 2020-01-06 07:35:51
问题 I have a script that changes particular string within files names (the file stores in "my_folder"): Set objFso = CreateObject("Scripting.FileSystemObject") Set Folder = objFSO.GetFolder("g:\my folder") For Each File In Folder.Files sNewFile = File.Name sNewFile = Replace(sNewFile,"._epf","_v0_1._epf") if (sNewFile<>File.Name) then File.Move(File.ParentFolder+"\"+sNewFile) end if Next the scrpit works fine if there are no folders under "g:\my folder", otherewise, if there are folders in "my

search and replace file names - bug fix

社会主义新天地 提交于 2020-01-06 07:35:09
问题 I have a script that changes particular string within files names (the file stores in "my_folder"): Set objFso = CreateObject("Scripting.FileSystemObject") Set Folder = objFSO.GetFolder("g:\my folder") For Each File In Folder.Files sNewFile = File.Name sNewFile = Replace(sNewFile,"._epf","_v0_1._epf") if (sNewFile<>File.Name) then File.Move(File.ParentFolder+"\"+sNewFile) end if Next the scrpit works fine if there are no folders under "g:\my folder", otherewise, if there are folders in "my

How to prevent PowerShell -Recurse from renaming first file twice?

╄→гoц情女王★ 提交于 2020-01-06 03:57:05
问题 When using powershell to rename files with their directory name and file name, my code works, except in the first file in a directory, it gives it two copies of the directory name. So the file book1.xlsx in folder folder1 should become folder1book1.xlsx but it becomes folder1folder1book1.xlsx . The remaining files in folder1 are correctly named folder1book2.xlsx , folder1book3.xlsx , etc. I have a directory, with many sub-directories. In each sub-dir are files that need their sub-dir name

Script to rename files to parent folder, move renamed file and delete empty folder

↘锁芯ラ 提交于 2020-01-05 07:25:51
问题 Wondering if anyone here can help me out. I'm using Windows 7 and have a collection of movies and TV shows in individual folders which I'd like to be renamed to that of the folder name. For example: ../Media Files/Example Movie (2013)/EM2013.avi to: ../Media Files/Example Movie (2013)/Example Movie (2013).avi I'd then like the newly named file to be moved to the Media Files folder, and for the (then empty) folder to be deleted. So: ..Media Files/Example Movie (2013).avi I've searched for a