From ef4a51f5aa1e1e8f3d571386f6bbb0eca4e51345 Mon Sep 17 00:00:00 2001 From: mattbk Date: Wed, 4 Feb 2015 15:52:55 -0600 Subject: [PATCH] Create addfileprefix.bat --- addfileprefix.bat | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 addfileprefix.bat diff --git a/addfileprefix.bat b/addfileprefix.bat new file mode 100644 index 0000000..41da91a --- /dev/null +++ b/addfileprefix.bat @@ -0,0 +1,22 @@ +:C.2.1.1 Summary +:This batch file adds a prefix to all file names with a certain extension (supplied by the user) in the working directory. This program was used to differentiate between multiple files from multiple analyses with the same filename. +:C.2.1.2 Requirements +:addfileprefix.bat must be located in the same directory as the files to be modified. +:C.2.1.3 User Input +:User is prompted for the three-letter extension of the files that will be modified, and for the prefix (which can be multiple characters) to be applied to the filenames. +:C.2.1.4 Output +:Prefix will be added to filenames of the type supplied by the user in the working directory. +:C.2.1.5 Listing + +@echo off +set dir=%CD% +set /p type=File type (extension): +set /p prefix=Prefix wanted: +md %prefix%prefix +for /r %%K in (*.%type%) do call :rename "%%K" +goto:eof +:rename +echo Adding prefix to %name% +set name=%~n1 +copy %name%.%type% "%dir%\%prefix%prefix\%prefix%%name%.%type%" +goto:eof