Moving folders with batch file and list

Log in to stop seeing adverts

Status
Not open for further replies.

Matt_B

Well-Known Member
First, apologies for the title, I couldn't think of a better one.

On our server at school we have a list of folders for each class, Class 1, Class 2 etc and within those I wanted one for each child. I have written a small batch script that cycles through all of the text files in the batch folder which are called Class 1.txt, Class 2.txt etc. Within these files is each child's name on a new line. So far so simple.

The problem will come next September when children move classes. They don't move together, so some of Class 1 will go to Class 3 with some of Class 2 etc. Is there a script that would go through a simple text file or CSV to move them from one folder to another?

ie.

Name Old Class New Class
Child A, 1, 3
Child B, 2, 3

and so on?

I'm thinking something like

xcopy P:\%oldclass%\*.* P:\%newclass%\*.*

My issue is how to get that info from the text file
 
first thought: use a database...or at least a master spreadsheet of data

two things to try

one...with a spreadsheet with everything you need, write a formula that the end forms an MSDOS command like

="copy c:\"&B2&"\"&A2&".txt c:\"&C2&"\"
copy c:\1\Child A.txt c:\3\

then create a load of MSDOS lines and spang them into the command prompt

secondly, you could write a VB script task that opens text files and loops through them
 
oh my formula needs work for the spaces in the DOS path, like

="copy "&CHAR(34)&"c:\"&B2&"\"&A2&".txt"&CHAR(34)&" c:\"&C2&"\"
copy "c:\1\Child A.txt" c:\3\
 
first thought: use a database...or at least a master spreadsheet of data

two things to try

one...with a spreadsheet with everything you need, write a formula that the end forms an MSDOS command like

="copy c:\"&B2&"\"&A2&".txt c:\"&C2&"\"
copy c:\1\Child A.txt c:\3\

then create a load of MSDOS lines and spang them into the command prompt

secondly, you could write a VB script task that opens text files and loops through them

The text files are only really useful as a first run, once the folders are created it's a case of moving them and everything in them.
 
Probably find that there's a way in Powershell to do this.
 
i'd still say vb scripting
 
Status
Not open for further replies.
Log in to stop seeing adverts

Championship

P Pld Pts
1Leicester4494
2Leeds Utd4590
3Ipswich4490
4Southampton4584
5Norwich City4573
6West Brom4572
7Hull City4570
8Middlesbro4566
9Coventry City4464
10Preston 4463
11Bristol City4562
12Cardiff City4562
13Swansea City4557
14Watford4556
15Sunderland4556
16Millwall4556
17QPR4553
18Stoke City4553
19Blackburn 4550
20Sheffield W4550
21Plymouth 4548
22Birmingham4547
23Huddersfield4545
24Rotherham Utd4524

Latest posts

Top