Microsoft
Software
Hardware
Network
Question : Load list.txt to bat file
Hi Experts!
We have in a Directory the files:
request0001_1.file
request0001_2.file
request0001_3.file
request0002_1.file
request0002_2.file
request0003_1.file
request0004_1.file
request0004_2.file
We make a file named list.txt with the content separeted by ";":
request0001;request0001_1.
file;works
heet2010.x
ls
request0001;request0001_2.
file;plan.
pdf
request0001;request0001_3.
file;plan2
010.doc
request0002;request0002_1.
file;contr
oll2010.do
c
request0002;request0002_2.
file;image
.jpg
request0003;request0003_1.
file;work_
2010.xls
request0004;request0004_1.
file;plan.
pdf
request0004;request0004_2.
file;photo
.gif
Where:
- The first column is the name of the folder should be created;
- The second column is the current file name;
- The third column is the name that the file should be (to be renamed)
I need load this list to loop do the following action(As the example below):
mkdir request0001
rename request0001_1.file worksheet2010.xls
move worksheet2010.xls request0001
The result is the structure:
request0001
file;worksheet2010.xls
plan.pdf
plan2010.doc
request0002
file;controll2010.doc
image.jpg
request0003
work_2010.xls
request0004
plan.pdf
photo.gif
How can i do this loop?
Answer : Load list.txt to bat file
This should do it.
for /f "tokens=1,2,3 delims=;" %%a in ('type list.txt') do (
md "%%a"
ren "%%b" "%%c"
move "%%c" "%%a"
)
Random Solutions
ESX 4, Can not add datastore
How can i implement the same desktop back ground image on all the computers on my domain
How to Truncate Body Text in SharePoint 2007 RSS Viewer Webpart
Modify DHCP scope on cisco pix 501
Link between Windows 7 activation and Windows 7 Experience Index
pictures that make customers more likely to buy shopping cart products
Is there a way to push a themepack to windows 7 computers via GPO? Or a powershell script?
Need some help resolving Tomcat Java Error (Unrecognized Windows Sockets error: 0: JVM_Bind)
Can't Uninstall Exchange Server 2007 SP1 from 2008 server R2
Implementing UrlRewriting for URLs of the form
http://myserver/mysite/mys
hortcuturl