Page 1 of 1

Deleting a remote file

Posted: Tue Jan 29, 2013 10:26 am
by jklare
I want to make sure to delete a file from a remote loacation after I am finished with it.
I get this error when I try.


INFO Executing sub-task 'delete'
1/28/13 6:16:01 PM INFO Closed the FTP connection
1/28/13 6:16:01 PM ERROR com.linoma.dpa.util.LocalFile
1/28/13 6:16:01 PM INFO Finished project 'GetServiceNow - working version'
1/28/13 6:16:01 PM ERROR [8099 - sftp] An unexpected error occurred.
com.linoma.dpa.util.LocalFile
com.linoma.dpa.runtime.JobFailedException: [8099 - sftp] An unexpected error occurred.
com.linoma.dpa.util.LocalFile


Any help is appreciated

Re: Deleting a remote file

Posted: Tue Jan 29, 2013 10:42 am
by jklare
More info....

Caused by: java.lang.ClassCastException: com.linoma.dpa.util.LocalFile
at com.linoma.dpa.tasks.ftp.DeleteAction.deleteFiles(Unknown Source)
at com.linoma.dpa.tasks.ftp.DeleteAction.execute(Unknown Source)
at com.linoma.dpa.tasks.ftp.AbstractFTPTask.execute(Unknown Source)
at com.linoma.dpa.ModuleV2.execute(Unknown Source)
at com.linoma.dpa.Project.execute(Unknown Source)
at com.linoma.dpa.runtime.Job.executeProject(Unknown Source)

Re: Deleting a remote file

Posted: Tue Jan 29, 2013 10:42 am
by Support_Julie
On your FTP GET output variables tab, there is a field to define the "Processed Source Files Variable". Enter something in that field. Then after you GET the files, you need to do an FTP DELETE and reference that variable. Without seeing your project, I am guessing that you are trying to delete the files on you local server rather than the remote server.
Code: Select all
<project name="FTP Get and Delete" mainModule="Main" version="2.0">

	<module name="Main">

		<ftp resourceId="192.168.1.54" version="1.0">
			<get destinationDir="/demo" whenFileExists="overwrite" processedSourceFilesVariable="ProcessedFiles">
				<fileset dir="/temp">
					<wildcardFilter>
						<include pattern="*.txt" />
					</wildcardFilter>
				</fileset>
			</get>
			<delete inputFilesVariable="${ProcessedFiles}" />
		</ftp>

	</module>

</project>

Re: Deleting a remote file

Posted: Tue Jan 29, 2013 11:13 am
by jklare
Thanks Julie. That worked.

Re: Deleting a remote file

Posted: Fri Feb 22, 2013 1:38 pm
by bmcgoldrick
What if I want to delete the file from the remote FTP host after doing a Get?

Re: Deleting a remote file

Posted: Fri Feb 22, 2013 2:37 pm
by Support_Rick
BMCGoldRick,

Julie's example has just that identified. It performs an FTP/get then a Delete of the files (ProcessedFiles)

Let us know if you have any other questions.

Re: Deleting a remote file

Posted: Fri Feb 22, 2013 4:15 pm
by bmcgoldrick
Rick,
I was confused because she says in her post "I am guessing that you are trying to delete the files on you local server rather than the remote server."
Thanks.

Re: Deleting a remote file

Posted: Fri Feb 22, 2013 5:33 pm
by Support_Rick
My apologies! I wasn't paying attention to his question, I was just indicating that the Example that she posted does exactly what you were asking. An FTP/Get of files from a server, then deletes those files after they have been retrieved to a local server.

I thought that's what you were looking to do. If so, just copy the code from her example above, change the resource ID's, Folders and/or File Patterns and it should do exactly what you need it to do!

Please let us know...