I am currently using SetFileInfo to change the modified date on a file(s). I need to get the value of INSTALLDIR into the script for the file location.
Can anyone help?
If so, GREATLY APPRECIATED!!!
Posted 13 February 2002 - 19:51
I am currently using SetFileInfo to change the modified date on a file(s). I need to get the value of INSTALLDIR into the script for the file location.
Can anyone help?
If so, GREATLY APPRECIATED!!!
Posted 13 February 2002 - 21:55
Sample:
//Get value of CMDLINE property. This is to provide backward compatibility for old scripts
nvSize = 1024;
MsiGetProperty(hMSI,"CMDLINE",CMDLINE,nvSize);
//Get value of SrcDir property. This is to provide backward compatibility for old scripts
nvSize = 1024;
MsiGetProperty(hMSI,"SourceDir",SOURCEPATH,nvSize);
//Get value of SrcDir property. This is to provide backward compatibility for old scripts
nvSize = 1024;
MsiGetProperty(hMSI,"INSTALLDIR",TARGETDIR,nvSize);
Note that nvSize is set before each call. This is necessary since the function resets this value to the buffer size of the retrieved value. Subsequent calls may leave the buffer too small for the next value.
There is also MSISetProperty to go in other direction
Posted 13 February 2002 - 22:27
I'll work with this.
Thanks!!!
Posted 14 February 2002 - 15:05
The next thing I need to know is how to join two string variables to form one larger string. For example:
svInstd should equal the value of INSTALLDIR
svDBDir will = an assigned value of a directory
which is present on all of our users
systems. I'll call the directory DBTest
here.
I need to join these together to form a path to certain files such as C:\DBTest (Another quick question - is the backslash part of INSTALLDIR or do I have to add it the the value of svDBDir as "\DBTest"?).
I was thinking of assigning this path value to a variable called svFileLoc.
Then I would like to assign values such as:
FILE1 = svFileLoc + "any file name".
Then I will be changing the files date through:
SetFileInfo (FILE1, FILE_DATE, 0, NEW_FILE_DATE).
Also, there are many files in svFileLoc which I would like to change (date that is). Can I use a wild card for the "any file name" above such as EXAM*.txt?
As you can probably tell, I'm not a 'coder' and I would GREATLY appreciate any pointers as to how to get this done.
As always, THANKS!
Posted 14 February 2002 - 16:48
Thanks again!
Posted 14 February 2002 - 23:32
With the SetFileInfo call, I don't think it will cope with multiple files. You'll have to use a FindAllFiles loop.
Hope this helps a bit.
Posted 19 February 2002 - 20:50
Thanks for the help!!!
Posted 20 February 2002 - 15:52
I have coded SetFileInfo and am able to change the modified date on a single file. I can then copy that line and change the file name in the command to execute on an additional file. What I don't want to do is to have 30+ SetFileInfo lines in the script. If there is a new database file, I may forget to put its corresponding line in the script.
I was hoping to use FindAllFiles (as Leigh suggested) to find all, let's say, Test*.mdb files in a certain directory which I'll call C:\TEST.
I have looked at the documention and the FindAllFiles example from Help, but, I can't make heads or tails out of it.
I was wondering if there is a pretty straight forward way of doing this.
As always, THANKS for any info.
I love this site!!!
Posted 20 February 2002 - 15:54
Is this a major concern?
Thanks again all!!
Posted 20 February 2002 - 23:28
nResult = FindAllFiles (svDir, svFileSpec, svMatchingFileName, RESET);
while(nResult = 0)
// Run your SetFileInfo call
SetFileInfo(svMatchingFileName,.......);
// Find the next matching file name.
nResult = FindAllFiles(svDir, svFileSpec, svMatchingFileName, CONTINUE);
endwhile;
svDir is the directory that you wish to search
svFileSpec is the specification you wish to match
After this loop has run through, if you are targeting NT include this line:
FindAllFiles(svDir, svFileSpec, svMatchingFileName, CANCEL);
I think the cancel line is just to release some file/directory locks.
Any other problems, just post again.
Posted 21 February 2002 - 13:59
FindAllFiles(svDir, svFileSpec, svMatchingFileName, CANCEL);
Posted 22 February 2002 - 00:53
Posted 26 February 2002 - 16:36