473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Kill hidden files

I am trying to delete the temporary files that MS Word leaves behind
sometimes when it fails to clean up properly. Files like ~$lename.dot. I
have used the Kill command, but find that this doesn't work for hidden files
like these. If I change their attributes it works perfectly. Is there a
command that can kill hidden files too? If not, how can I get around this
as this problem prevents some mailmerge templates from operating by
automation because the last time they were used, Word did not delete the
hidden file. I am using VBA to do this as I want to run the command off a
button. I am picking up the path from a DLookup as it varies from site to
site.

Function KillTempFiles()
If Dir(DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot") > "" Then
Kill (DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot")
End If
On Error Resume Next
End Function

dixie
Nov 13 '05 #1
1 5652
dixie wrote:
Is there a
command that can kill hidden files too? If not, how can I get around this
as this problem prevents some mailmerge templates from operating by
automation because the last time they were used, Word did not delete the
hidden file. I am using VBA to do this as I want to run the command off a
button. I am picking up the path from a DLookup as it varies from site to
site.

Function KillTempFiles()
If Dir(DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot") > "" Then
Kill (DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot")
End If
On Error Resume Next
End Function


The Dir() function takes a 2nd parameter where you can specify hidden files
if you want (with vbHidden).

There is also the SetAttr and GetAttr commands that you can use to set or
get file attributes.

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
7
by: Krisa | last post by:
I've begun using the technique of putting temporary tables in a temporary database in my C:\Temp folder. Everything is fine except I can't kill the database when exiting Access. I get a...
7
by: David Mitchell | last post by:
I use a function to read all of the files from a couple of directories (and subfolders) and update a table(tblfiles) with the fullpath and file name, the filesize and the date the file was created....
4
by: Greg Bell | last post by:
Hi, Can someone tell me where to look to enable me to read "Folder Options" user settings for hidden/system files from within C#/VB.Net/Any other .NET language. I'm pretty sure it must be part...
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
3
by: Scott | last post by:
Hello, I am running into a problem with my code and can't seem to figure out the solution. I know it has to do with the pciture box control and unloading the image inthe picture box but I can't...
5
by: Dino Buljubasic | last post by:
My application can allow a user to open a file for viewing by fetching file data from database, creating the file in a temp directory and starting appropriate process (i.e. Adobe or any other...
14
by: Dixie | last post by:
I am trying to write some code that when I exit my application kills all of the text files in a certain folder. It is possible that some of those files are locked because someone else is using...
18
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for reasons I do not know, a Connect call will totally lock up the thread and never return. I am sure it has something to do...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.