batch-rename

Batch add string before filename

回眸只為那壹抹淺笑 提交于 2019-12-20 05:03:11
问题 I'm working on a Windows batch file and I need to change name of files in current direcotry. I have these files: file1.txt file2.txt file3.txt and I need to add string "REG~" before each filename like this REG~file1.txt REG~file2.txt REG~file3.txt Thank you. 回答1: @echo off SETLOCAL ENABLEDELAYEDEXPANSION SET old=file SET new=REG~file for /f "tokens=*" %%f in ('dir /b *.txt') do ( SET newname=%%f SET newname=!newname:%old%=%new%! move "%%f" "!newname!" ) What this does is it loops over all

dos command to sperate file name and extension into variables

六月ゝ 毕业季﹏ 提交于 2019-12-18 10:56:31
问题 I need to copy a file x.dtsx from location a to location b. If x.dtsx already exists in b then I need to rename x.dtsx to x_Standby.dtsx Then, after renaming copy x.dtsx to b My current code looks like this: if exists %1 rename %1 %(should be 1_standy.extension) xcopy %1 %2 回答1: If you use the Command Processor Extensions (which is default on Windows 2000 and later) then you can use the following optional syntax: %~1 - expands %1 removing any surrounding quotes (") %~f1 - expands %1 to a

How do I rename files in sub directories?

萝らか妹 提交于 2019-12-17 15:23:49
问题 Is there any way of batch renaming files in sub directories? For example: Rename *.html to *.htm in a folder which has directories and sub directories. 回答1: Windows command prompt: (If inside a batch file, change %x to %%x) for /r %x in (*.html) do ren "%x" *.htm This also works for renaming the middle of the files for /r %x in (website*.html) do ren "%x" site*.htm 回答2: For windows, this is the best tool I've found: http://www.1-4a.com/rename/ It can do anything AND has the kitchen sink with

Batch Rename Files With Similar Name

假装没事ソ 提交于 2019-12-13 18:35:14
问题 I am trying to create a batch script to rename downloaded files. After downloading, the files have similar names that include a timestamp. The timestamps in the name differ from the value of the "last modified" timestamp (typically by only a few seconds). For example: Export_2013_11_06_15_13_31.csv Export_2013_11_06_15_13_41.csv Export_2013_11_06_15_13_51.csv etc. Each of these files needs to be renamed to a SPECIFIC name in alphabetical order according to their last modified timestamp (not

Windows bat file to rename multiple files with custom names

佐手、 提交于 2019-12-13 09:12:19
问题 I have multiple folders with multiple files in each of them. The file names are as following: static-string -1.wav static-string -2.wav .... static-string -10.wav ... static-string -99.wav static-string -100.wav ... and so on. The static string remains same but the number before .wav changes from 1 - 999. Now the problem is if I want to play this on any media player or want to join all the files, windows will sort like 1,10,100,2,20,200 not 1,2,3,4,5,6,7,8,9,10 which messes up the playback.

Rename different files to one file name, one at a time

浪子不回头ぞ 提交于 2019-12-13 08:58:40
问题 i have files named.. 82011.nsf 63113.nsf 55555.nsf i must rename each file to single.nsf (for example ren 82011.nsf to single.nsf) then use a program to act on that file (single.nsf) then rename the next file (63113.nsf to single.nsf) then use a program to act on that file (single.nsf) etc I want a batch file to do the nename, pause (so i can run the other program), then do the next rename until all nsf files are done. how? 回答1: for %i in (*.nsf) do ( rename %i single.nsf do_the_job pause )

batch file to copy some files and changing their name

半世苍凉 提交于 2019-12-13 04:03:31
问题 I need to create a batch file to copy some files. I have several files on a folder, having all of them a date as part of the filename, and only some of them have the current day date. i.e.: backupone_2013-11-19.zip backupone_2013-11-18.zip backupone_2013-11-17.zip backuptwo_2013-11-19.zip backuptwo_2013-11-18.zip backuptwo_2013-11-17.zip I need to duplicate (copy in the same folder) only those files named with current date, naming the new files with the format (left 8 chars)&"last".zip Using

Batch files for Adding random numbers (3 digits) in front of files and for removing the numbers

▼魔方 西西 提交于 2019-12-13 03:45:23
问题 I'm interested in 2 batch files: one that generates random numbers (3 digits) and puts them in front of every MP3 file in a folder, and the other batch for removing these random numbers. My attempt at the first batch: @echo off setlocal EnableDelayedExpansion for %%i in (*.mp3) do ( ren "%%i" "!RANDOM!%%i" ) endlocal The problem: the numbers are up to 5 digits. My attempt at the second batch: @echo off setlocal enableextensions enabledelayedexpansion for %%i in (*.mp3) do (set name=%%i && ren

Rename current file with variable value

僤鯓⒐⒋嵵緔 提交于 2019-12-13 03:10:01
问题 I am simply trying to get the value of column ' ID ' where two rows meet (meet where Name and Zip are on the same row) then with that row number, I get column ' ID ' value to rename file with. I don't think writing the ' .rename ' correctly for one.. any pointers appreciated. Currently no error, but no output either. import PyPDF2 from PyPDF2 import PdfFileWriter, PdfFileReader import re import config import xlrd import numpy as np import pandas as pd import math import os for filename in os

Batch script to remove parts of a filename

自闭症网瘾萝莉.ら 提交于 2019-12-13 01:25:52
问题 Help please! I need to remove time stamp and file number off of the filename using a windows batch script. Thank you! Thank you in advance! OLD Filename= CAM168-NOTSET.2013.10.01.18.45.45.882.jpg NEW Filename= CAM168-NOTSET.jpg 回答1: @ECHO OFF SETLOCAL SET "fname=CAM168-NOTSET.2013.10.01.18.45.45.882.jpg" FOR %%i IN ("%fname%") DO FOR /f "delims=." %%j IN ("%%i") DO ECHO REN "%%~i" "%%~j%%~xi" GOTO :EOF New name merely ECHO ed. 回答2: If by "remove time stamp and file number" , you mean remove