Exclude Folders in a File List?
Exclude Folders in a File List?
I have a project that does an inventory of our FTP site. It does this by using a simple "file list" action to generate a list of every file on the FTP site. I set it to the root folder of the FTP site and set its "recursive" value to TRUE. This successfully generates a file list containing all files. However, there are some folders I do not need reported. I've tried using a wildcard filter to exclude the folder names, but had no luck, it still reported files in those folders. How could I tell the recursive file list to skip over certain folders?
I know I could set this up a different way, having a separate task to inventory each folder that I want (and simply don't create a task for the folders I don't want). However, due to the number of folders we use, this would be a time-consuming task to implement and update should we ever add/change/delete a folder. I assumed excluding folders would be simple. That'll teach me to assume!
Any help is greatly appreciated. Thanks.
- rcraig
- Posts: 3
- Joined: Wed Mar 03, 2010 3:35 pm
Re: Exclude Folders in a File List?
We do have a temporary solution that may work for you but it will require more steps to exclude or include changes.
- Support_Mary
- Support Specialist
- Posts: 8
- Joined: Tue Feb 09, 2010 10:16 am
Re: Exclude Folders in a File List?
Having this new folder filter feature (alliteration anyone?) would allow easy setup of a full FTP inventory as I could just exclude folders I don't want reported, and thus cut down thousands of files in the report.
Right now if I do a full inventory, it reports ALL files, unless I manually exclude certain file names/extensions, which there are hundreds of.
Your temporary solution may be of interest. Could you provide a brief explanation of what would be involved?
Thanks.
- rcraig
- Posts: 3
- Joined: Wed Mar 03, 2010 3:35 pm
Re: Exclude Folders in a File List?
The following xml code will provide a general idea of what you need to do.
- Code: Select all
<createFileList version="1.0" fileListVariable="filesInRoot">
<fileset dir="/djohnson" recursive="true" />
</createFileList>
<print version="1.0" file="/filelist/filesfound.csv" append="false">
<![CDATA[${filesInRoot}]]>
</print>
<readCSV version="1.0" inputFile="/filelist/filesfound.csv" outputRowSetVariable="data" skipFirstRow="false" fieldDelimiter="pipe" recordDelimiter="LF" />
<sql version="1.0" resourceId="Dev61">
<query label="create file">
<statement>create table qtemp.onefield (fld01 char(256))</statement>
</query>
<query label="fill file" inputRowSetVariable="${data}">
<statement> insert into qtemp.onefield values(?)</statement>
</query>
<query label="select records" outputVariable="remainingFiles">
<statement>select * from qtemp.onefield where fld01 not like '%/${folderName}/%'</statement>
</query>
</sql>
<writeCSV version="1.0" inputRowSetVariable="${remainingFiles}" outputFile="/filelist/remainingFiles.csv" whenFileExists="overwrite" includeHeadings="false" fieldDelimiter="pipe" recordDelimiter="LF" textQualifier="none" />
For the statement select * from qtemp.onefield where fld01 not like '%/${folderName}/%' you’ll need to either create and fill a variable named folderName or change that value to the actual folder name you wish to exclude.
- Support_Duane
- Support Specialist
- Posts: 66
- Joined: Thu Mar 05, 2009 2:49 pm
Who is online
Users browsing this forum: No registered users and 0 guests