Search : in
By :

Batch script to rename all the files in a dir

sliny, on Oct 19, 2009 2:33:57 pm BST 
 Report this message to moderators

Hello,
I need help writing a batch script which will be executed on Windows 2003,
to rename all the files in a directory and move all those in to a different archive directory.
d:\
abc_123.txt --> rename to abc.txt (rather trimming the last few chars from the file name)
bcd_147.txt --> rename to bcd.txt
cdc_345.txt --> rename to cdc.txt
----
----


then
move abc,bcd,cdc to e:archive\
pleas ehelp.
Thanks

Configuration: Windows 2003 server
Firefox 3.5.3

Best answers for « batch script to rename all the files in a dir » in :
Writing in batch in text file ShowWriting in batch in text file To write in a file text, you just have to use a redirect: echo text > output_file.txt To write in an existing file: echo " Write at the end of the file ">> output_file.txt
Renaming multiple files in batch ShowRenaming multiple files in batch Native features Using a third-party program Renaming a large number of files can quickly become tedious. Fortunately, there are tools to automate this task in many cases: Native features On Windows...
How to read a file line by line ShowHow to read a file line by line Intro Tips Bonus Intro One of the most common errors of learning scripts bash on GNU / Linux is to read a file line by line, is to use a loop "for" (for line in $ (cat file.txt) do. ..), which in this...
Download Lupas Rename ShowLupas Rename is a program allowing to rename several files at the same time. The features of this software : - To rename files or directories - To ename files in récursive sub-directories - Shell integration (right button on a folder) - To...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...
UNIX system - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence its name "shell". The shell therefore acts as an intermediary between the operating system and the user using command lines...