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
1Leicester4697
2Ipswich4696
3Leeds Utd4690
4Southampton4687
5West Brom4675
6Norwich City4673
7Hull City4670
8Middlesbro4669
9Coventry City4664
10Preston 4663
11Bristol City4662
12Cardiff City4662
13Millwall4659
14Swansea City4657
15Watford4656
16Sunderland4656
17Stoke City4656
18QPR4656
19Blackburn 4653
20Sheffield W4653
21Plymouth 4651
22Birmingham4650
23Huddersfield4645
24Rotherham Utd4627

Latest posts

Top