Page 1 of 1

How to remove a specific repeatedly uploaded file?

Posted: Thu Nov 01, 2018 11:39 am
by draymer
We have a client that keeps uploading a Thumbs.db file every 5 minutes and it creates a ton of triggers. They also upload additional files periodically so I can't quite ignore it, but I want to the project to delete the Thumbs.db file every single time they upload before it even goes thru the rest of the project to push the files to another location.

I tried doing this but it bombs out with "ERROR [8099 - Create File List] An unexpected error occurred. Variable not found: Thumbs.db" and I'm a little confused:
Code: Select all
		<createFileList fileListVariable="files" version="1.0">
			<fileset dir="/path/to/inbound/" recursive="false" sortedBy="name" sortOrder="ascending">
				<wildcardFilter>
					<include pattern="*" caseSensitive="false" />
				</wildcardFilter>
			</fileset>
		</createFileList>

		<if label="If Thumbs.db File" condition="${files eq Thumbs.db}">

			<delete label="Delete Thumbs.db file" file="/path/to/inbound/Thumbs.db" version="1.0" onError="continue" />

			<else>
I know this is going to be a simple solution but it's driving me crazy trying to get this working. Thanks

Re: How to remove a specific repeatedly uploaded file?

Posted: Tue Dec 18, 2018 12:02 pm
by Support_Andy
There are several ways to handle these unwanted files. Attached is a basic project that lists out the directory and then uses a For Each Loop to loop through each file looking for a file named ‘thumbs.db’, if it detects the file it deletes it. You can then use the else condition to do your normal tasks in the project.
Note: Project XML attachments are not valid on every version of GoAnywhere
This attachment was created in version 5.7.7
Delete a thumbs db file.xml
Delete a thumbs db file
(608 Bytes) Downloaded 254 times