Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding Files

Status
Not open for further replies.

KimberlyBarkman

Programmer
Jun 25, 2004
4
US
I need to search a folder for all csv files older than a specific date and delete/kill those files. The problem is, all the actuate file functions I see require the full directory and file name. I don't know the file names.

Are there any file functions that support wildcard characters?

In VB, the Dir() funtions does what i need, but Actuate Basic doesn't support this function.

Suggestions would be appreciated!

Kimberly
 
Not sure which version of Actuate you're using, but here is the help file for version 7:

Deletes a specified file or files from a disk.

Syntax
Kill <file spec>

Parameters
<file spec>

String expression that specifies the name or names of the file or files to be deleted. Wildcard characters can be used. Can include optional drive and path information.

Default path: Current default drive and directory.

Rules:

Indicated file or files must exist.
Path, if specified, must exist.
Indicated file must not currently be open by Actuate Basic.
<file spec> may optionally specify full path information, in which case it has the following syntax:

[<drive:>] [ \ ]<directory>[\<directory>]...<file spec> (Windows)

[/]<directory>[/<directory>]...<file spec> (UNIX)

<drive:>

Character, followed by a colon, that specifies the drive where <file spec> is located (Windows only).

<directory>

String expression that specifies the name of a directory or subdirectory where <file spec> is located.

Example:

The following statement deletes all files in the Windows directory
C:\Discard that have an extension of .doc:

Kill C:\Discard\*.doc
Description
Kill is similar to the operating system commands ERASE and DEL.

Tips
Be careful in how you use Kill, especially if you include wildcard characters in <file spec>. It is easy to delete files unintentionally, and Kill is irreversible.
To delete directories, use RmDir.
 
Thanks for the tip! Unfortunately, I can't kill all csv files, only those that are older than a specific date. My plan was this.
1. look in the specified dir for *.csv and return the full path of the first file. VB's DIR() method does this, but i cannot find an Actuate Basic equivalent.
2. use GetAttr(FileName) to see if the date is more than 10 days old.
3. If yes kill filename.
4. Loop until all files have been checked.
 
Not sure about this and wildcards:

Syntax
FindFile(<filename>)

Parameters
<filename>

The relative file path.

Returns
If the file is found, the absolute path to the file.
If the file is not found, an empty string.
Description
Call FindFile to resolve a relative file name by searching for the file through the existing search path.

You can call FindFile at factory time, view time, or both. If you call FindFile at factory time, Actuate searches for the specified file only at run time. In this case, Actuate searches the following:

If the referring .rod file is open, the design search path.
For information about the design search path, see Chapter 5, “Customizing the design environment,” in Developing Advanced e.Reports.
The search path specified in the ExtendSearchPath function when ExtendSearchPath is called at factory time.
Global search path.
For information about the global search path, see Chapter 5, “Customizing the design environment,” in Developing Advanced e.Reports.
Configuration file search path.
For information about the configuration file search path, see Appendix A, “Using a configuration file,” in Developing Advanced e.Reports.
If you call FindFile at view time, Actuate searches for the specified file only at view time. In this case, Actuate searches the following:

The search path specified in the ExtendSearchPath function when ExtendSearchPath is called at view time.
Global search path.
For information about the global search path, see Chapter 5, “Customizing the design environment,” in Developing Advanced e.Reports.
Configuration file search path.
For information about the configuration file search path, see Appendix A, “Using a configuration file,” in Developing Advanced e.Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top