#1 31 Mar 2006 19:25

Mrkent69
Member
Registered: 31 Mar 2006
Posts: 3

Batch process to create files from a list of items

I'm trying to create multiple text files roughly 1000. I've got a text file with the 1000 names I'd like to use. Is there an easy way in either XP/2K or PHP to create a script or run from the command line in order to batch create these 1000 files?

If I'm not explaining the problem enough, please let me know.

Thanks

Ed

Offline

#2 31 Mar 2006 19:33

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 1,005
Website

Re: Batch process to create files from a list of items

look at the examples on the for /f page

http://ss64.com/nt/for_f.html

to create a file you just change the ECHO... to ECHO... >file.txt and use parameters (%%G etc) to change parts of the filename to values from the file

Offline

#3 31 Mar 2006 20:37

Mrkent69
Member
Registered: 31 Mar 2006
Posts: 3

Re: Batch process to create files from a list of items

Simon,

So let's say I want to create five files from the command line. How would it look?

ECHO file.txt %%G name1 name2 name3 name4 name5

Would that give me five unique files in a directory like this:

name1.txt
name2.txt
name3.txt
name4.txt
name5.txt

Ed

Offline

#4 31 Mar 2006 22:23

Mrkent69
Member
Registered: 31 Mar 2006
Posts: 3

Re: Batch process to create files from a list of items

FOR %G IN (ed john erica) DO FSUTIL file createnew %G.txt 10

there it is folks!

Thanks for pointing me in the right direction! smile

Offline

Board footer

Powered by FluxBB