# Copy a file list

**URL:** https://www.finalbuilder.com/forums/t/copy-a-file-list/564
**Category:** Discussion
**Created:** [August 16, 2007, 2:56am UTC](https://www.finalbuilder.com/forums/t/copy-a-file-list/564 "2007-08-16T02:56:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [August 16, 2007, 2:56am UTC](https://www.finalbuilder.com/forums/t/copy-a-file-list/564/1 "2007-08-16T02:56:14Z")

</div>

Hello,

I have a variable that looks like this

"file1.dat,file2.dat,file3.dat"&nbsp; (Filenames separated with comma)

or

"file1.dat;file.dat;file3.dat" (Filenames separated with semicolon)

I want to copy these files with XCopy from one folder to another.

So, how to create a loop on the filenames?

Is there a way to split a string to tokens?

Or is there a way to copy a file list?

Or is there a way to create a _File Set_ from this string variable?

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [August 17, 2007, 5:02am UTC](https://www.finalbuilder.com/forums/t/copy-a-file-list/564/2 "2007-08-17T05:02:29Z")

</div>

1. Replace the commas with linefeeds (using text find/replace)   
 2. Use a List Iterator over the new string   
 3. Copy each item in the list.   
  
 There may be other ways, too, but that’s my normal approach.   
  
 Steve
