Skip to content

forEachLoop- compress file in file list

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • ernguyen Offline
  • Posts: 11
  • Joined: Fri May 22, 2015 3:21 pm

forEachLoop- compress file in file list

Post by ernguyen »

Hey guys, is it possible to use a forEachLoop with a file list to compress each file on its own? Below is my attempt which fails. When i run the project in debug i can see the variable {file} has a value of "Remote File" and not full instantiated file with path

Code: Select all

			<forEachLoop itemsVariable="${src01_list}" currentItemVariable="file">
				<zip label="compress" inputFilesVariable="${file}" outputFile="./archive/${file:nameWithoutExtension}.zip" version="1.0" />
			</forEachLoop>

example:
{sr01_list} =
./abc.txt
./123.txt

desired result
./archive/abc.zip
./archive/123.txt
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: forEachLoop- compress file in file list

Post by Support_Rick »

ernguyen,

Make sure you are using a LOCAL file list variable. What you're describing indicates you are using a REMOTE file list variable.

When using the LOCAL file list variable, you should be able to do exactly what you're trying to do. But, I'm thinking that ${src01_list} is the REMOTE file list and not a LOCAL file list.

Make sure and try your archive again.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • ernguyen Offline
  • Posts: 11
  • Joined: Fri May 22, 2015 3:21 pm

Re: forEachLoop- compress file in file list

Post by ernguyen »

Thanks Rick, you are correct. My example of {src01_list} was actually /ftp.server.../abc.txt as opposed to ./abc.txt
Post Reply