CFile (delete file)

How can I delete all files that end with ".temp" in some folder? 


0
my.fake (136)
6/29/2005 12:18:24 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
878 Views

Similar Articles

[PageSpeed] 52

CFile::Remove
remove
unlink

--
cheers,
Alok Gupta
Blogs: http://wdevs.com/thatsalok
"Petar Popara" <my.fake@mail.net> wrote in message
news:Op6#URKfFHA.2644@TK2MSFTNGP09.phx.gbl...
>
> How can I delete all files that end with ".temp" in some folder?
>
>


0
thatsalok1 (226)
6/29/2005 12:35:04 PM
SHFileOperation() will and it supports wildcards!  DeleteFile() will operate
on one file at a time.

"Petar Popara" <my.fake@mail.net> wrote in message
news:Op6%23URKfFHA.2644@TK2MSFTNGP09.phx.gbl...
>
> How can I delete all files that end with ".temp" in some folder?
>
>


0
6/29/2005 1:11:59 PM
Is this the right syntax?

CString deleteAll = s_rootDir + "*.temp" + '\0';
SHFILEOPSTRUCT shFileOp;
ZeroMemory(&shFileOp, sizeof(SHFILEOPSTRUCT));
shFileOp.hwnd = NULL;
shFileOp.wFunc = FO_DELETE;
shFileOp.pFrom = deleteAll;
shFileOp.pTo = NULL;
shFileOp.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
SHFileOperation(&shFileOp);

I'd like to delete all files that ends with "*.temp" in the given folder, 
without prompting the user or showing any dialogs (server side app). 


0
my.fake (136)
6/30/2005 7:12:57 AM
Better use this wrapper in your application :)
http://www.codeproject.com/shell/cshellfileop.asp

--
cheers,
Alok Gupta
Blogs: http://wdevs.com/thatsalok

"Petar Popara" <my.fake@mail.net> wrote in message
news:O5zSSLUfFHA.2484@TK2MSFTNGP15.phx.gbl...
>
> Is this the right syntax?
>
> CString deleteAll = s_rootDir + "*.temp" + '\0';
> SHFILEOPSTRUCT shFileOp;
> ZeroMemory(&shFileOp, sizeof(SHFILEOPSTRUCT));
> shFileOp.hwnd = NULL;
> shFileOp.wFunc = FO_DELETE;
> shFileOp.pFrom = deleteAll;
> shFileOp.pTo = NULL;
> shFileOp.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
> SHFileOperation(&shFileOp);
>
> I'd like to delete all files that ends with "*.temp" in the given folder,
> without prompting the user or showing any dialogs (server side app).
>
>


0
thatsalok1 (226)
6/30/2005 7:30:23 AM
Reply:

Similar Artilces:

delete footer
How do I delete a pre-existing footer from a page. We are making a poster. We can go to within 1/4" or less from the top, but the program is forcing us to leave 1/2" on the bottom. Is this due to our printer, or a problem with publisher? -- Ferret Mom PK <PK@discussions.microsoft.com> was very recently heard to utter: > We can go to within 1/4" or less from the top, but the > program is forcing us to leave 1/2" on the bottom. Is this due to > our printer, or a problem with publisher? This is a limitation of your printer. Due to the mechanism used i...

2 different Deleted Items folders??
Decided to try Outlook after years with OE. Set up email and news accounts. Imported messages from OE. When I open Outlook, show Folders, I see Outlook Today - [Personal Folders], Deleted Items, Inbox, etc. I emptied the Deleted Items folder. Then, View, Goto, News, show Folders, I see Outlook Newsreader, Local Folders, then most of the same folders that I see under Personal Folders in the Outlook window, including another Deleted Items folder, and this one isn't empty. Where did I go wrong? Al The Outlook Newsreader is actually Outlook Express which maintains its own folder...

Missing file
I'm getting an error message telling me I'm missing C:\Windows\system 32\mshtml.hlp. How can I get a copy of the file? The message appears whenever I try to save a picture from a newsgroup. Jeff -- "Never attribute to malice that which is adequately explained by stupidity." Richard Feynman Nobel Prize Physicist IE version? Jeff Stanton wrote: > I'm getting an error message telling me I'm missing C:\Windows\system > 32\mshtml.hlp. How can I get a copy of the file? The message appears > whenever I try to save a picture from a newsgrou...

Delete Columns
In Excel, I need a macro that will delete a column based on a cell that will contain a name based on an input box. Thanks, Bernie See you OTHER post. -- Don Guillett SalesAid Software dguillett1@austin.rr.com "Bernie" <bml66@aol.com> wrote in message news:1172699736.687460.300590@h3g2000cwc.googlegroups.com... > In Excel, I need a macro that will delete a column based on a cell > that will contain a name based on an input box. > > Thanks, > Bernie > ...

Excel file takes a long time to save
I have a 1,000 x 15 straight worksheet with no formulas - about 100K. I went to auto-format a pattern, but didn't select the area and if formatted the entire spreadsheet. It's since gone from 5 seconds to 60 seconds per save and I can't reverse this, even by changing the auto-format setting to "none." I'm backed-up, but the current version is about three hours ahead and it will take longer to retrace the work by hand. Any suggestions? Thanks, Ben Try resetting the last used cell. Debra Dalgleish has some techniques at: http://www.contextures.com/xlfaqApp.html#Un...

Autocomplete File Editor for NK2 file
Whew, At first I started writing to each person with a problem about this utility that I found to open and edit the NK2 file. I didn't know there would be so many so I thought I'd post this. The utility is called Owtlook File Editor It can be found at www.dcs-imaging.com/products.htm Good luck ...

save only filtered results to csv/txt file
Excel 2000, Win98SE. I need to filter an xls file and then save only what is shown to a csv/txt file. The master xls file has new data added in a single import each day. Then I will have to filter the file 2 or 3 ways and save the filtered results to seperate csv/txt files, so I need to streamline the process. Also is there a means, comparable to scenarios, that I can use to set up different filtering combinations and then easily switch between them? Suggestions welcome. Thanks. -- Igor Igor You should be able to copy and paste the data to a new workbook and save that. Alternative...

Excell2003 (SP-1) File > Save and File > Save As.. grayed out
Got a user who has Excell2003 and cannot File > Save or File > Save As... He can, however, ctrl-s to save spreadsheets. Any ideas? I"m clueless. JM ...

Microsoft File Password Recovery
Hi All A friend and I at work have a file that we cannot open because it was password protected and we can't remember the password. Is someone able to recommend some free file open password breaker software? Otherwise, could I send the file to someone to open the file? For clarity, it is not within the excel worksheet or workbook, it is a password to open the excel file! With thanks Nick well if it was a workbook/sheet password, i'd say www.straxx.com as it' a free password add-in, very effective too. but if it's not one o those passwords, what is it? external? v...

Multi-User Excel File on a Network Drive
How can I make an Excel file accessible to multiple users concurrently? With all able to make and save changes to the same file. Thanks, Mike "Mike" wrote > How can I make an Excel file accessible to multiple > users concurrently? With all able to make and save > changes to the same file. Tools / Share Workbook Jordon ...

How do I Insert 2C Mac EPS file into Publisher ?
In commercial printing we get a lot of logo's and other art that is created as a Mac EPS and I cannot seem to insert it into Publisher. What are the correct steps for doing this and for it to display. According to Pub 2003, you need a graphics filter to insert .eps files. The following is copied directly from the Help file: The Encapsulated PostScript (EPS) graphics filter (Epsimp32.flt) supports the Adobe Systems Encapsulated PostScript Specification versions 3.0 and earlier. The filter supports .eps images from Tagged Image File Format (.tif, .tiff) (Tagged Image File Format (TIF...

Problem with Conditional format deletion
I have the followint formula in a conditional format. =ROW()=ROW(INDIRECT(CELL("address"))) I remember getting it from this group, it highlights the active cell in yellow. I cannot delete it and I believe it will not allow me to copy and paste data about the spreadsheet. I need to delete as I need to copy and paste more than I need the active cell highlighted. Hi if you want to highlight always the active cell you need VBA. See: http://www.cpearson.com/excel/excelM.htm#HighlightActiveCell -- Regards Frank Kabel Frankfurt, Germany <mark@southwestconst.com> schrieb im Newsbei...

Rule to delete junk mail does not always work
I have created a rule to delete any mail which contain certain characters or words. This appears to work sometimes but some of the mail containing these words still gets through (usually finish up in the Junk mail folder). When I run the rule on the Junk Mail folder these emails get deleted! So the rule would seem to be ok. Any idea why the rule does not always work? Al PE <pitsofearth@msn.com> wrote: > I have created a rule to delete any mail which contain certain > characters or words. This appears to work sometimes but some of the > mail containing these words ...

Public Folder File sizes
Hi We have a system whereby files from our students are routed to a public folder, so that everyone in the office can see them. However some of our more unenlightened students seem to be trying to send in emails with 9Mb attachments. (AGHHHH) The odd thing is that if they send them to a persobal mailbox, they seem to get thropugh, but if theu send them to a public folder, Exchange cant handle them, or at least we can see them being received, but then they are not delivered to the public folder. Is there something i need to do to get round this please? Thanks A Do you have Maximu...

Multiple database files created
I have an Access 2007 database that resides on our company's server. The database tracks incoming and outgoing shipments and is used by several employees throughout the day. I've noticed that in the folder where the database resides several additional database files are created throughout the day with names like database.mdb, database1.mdb, database2.mdb, etc. Can anyone tell me why this is happening? The database was created with Access 2007 using the 2003 mdb file format, as most of the end users have Office 2003 applications. Ken Warthen kenwarthen@gmail.com 1. Turn off...

Deleted Items #6
On the menubar go to Tools/Options Select the Other tab Checkbox for Empty the Deleted Items folder upon exiting is grayed out. Is there a way to "turn on" this option? Thanks ...

my file still exists but is blank please help
I had a virus completely delete a file in my microsoft word 2000. It's old and I don't know what to do. The file name is still there but the text is blank, and I've tried several recovery progrms that haven't retrived it. Was hoping someone knew if word has its own back to retrieve things from and how to use it If the contents have been overwritten (and it certainly seems as if that is the case), there isn't anything you can do, I'm afraid. -- Stefan Blom Microsoft Word MVP "hanna" <hanna@discussions.microsoft.com> wrote in messa...

Compress an Excel File
I have an excel file that is 36 meg. Do you know how to compress the file? When I zip the file it drops to 3meg so I know it can be compressed. I beleive the file has become large due to the constent changes I need to make to the file. Help Please. Hi Mandy Maybe this will help? http://www.contextures.com/xlfaqApp.html#Unused You can use Rob Bovey's Code cleaner to clean up your code http://www.appspro.com/utilities/utilities.asp -- Regards Ron de Bruin http://www.rondebruin.nl "Mandy" <mangelo@arbys.com> wrote in message news:42c401c47fa1$ddc405d0$a401280a@...

Closing multiple files independantly
When I have 2 seperate excel files open...and I click on the red 'x' on the top right on one of the files...both files close. How can I get it to only close the 1 file I'm clicking on? Thanks, Frank. Hi Frank, Look just below the red X; the three symbols (miminize, restore and close) are repeated but in a simpler format. These control a workbook while the top one control the Excel application. If you ever want to close all the file but leave Excel open, hold down Shift and open the File menu - look for a new item "Close All". Bernard "Frank DAlessandro" ...

Tidying up Office Data Files
My Office Data files are in a mess. I have discovered that I have Outlook (approx 0.8GB) and Outlook1 (approx 0.8GB) Mailbox (32KB) and Archive (0.35GB). I created Archive some time ago but have not archived recently. I don't know why I have 2 Outlook files - possibly created when I transferred data to a new laptop a few weeks ago. I would like to re-combine everything into 1 file so that I can start again and set up a proper Archive system again. How can I do this without risking losing files or creating duplicates or triplicates. As you will note the files are very big! Any h...

Recovering an accidentially deleted folder with messages
I have Outlook Express. I deleted a folder by accident but found it in recycle and dragged it back into the Outlook Express directory where other folders are (it is a "dbx" file there). Is there any way to restore it as an Outlook Express folder? Just clicking on it doesn't work. Thanks! Bob "Bob" <anonymous@discussions.microsoft.com> wrote in message news:03db01c398fb$923c3b60$a601280a@phx.gbl... > I have Outlook Express. I deleted a folder by accident > but found it in recycle and dragged it back into the > Outlook Express directory where othe...

Opening a a a file handle as a file pointer
Hi all I have a file handle. I want to open it as a FILE stream so that I can use higher level operators like cin/cout and fprintf/fscanf. Can someone suggest me a solution? Obviously the process startup code converts the file descriptor is receives from parent for stdin,stdout and stderr. So there should be a function to do it. regards, Sudhakar "sudhakarg79" <sudhakarg79@discussions.microsoft.com> wrote in message news:ECF7527B-A036-48EF-B2FB-CA8985330D3E@microsoft.com... > > Hi all > > I have a file handle. I want to open it as a FILE stream so...

make excel files with same names to be opened at one time
It is very difficult to work if you want to compare changed data made in the file with old one ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/community/en-us/default.mspx?mid=cde27763-1bc7-4299-874f-ac53e066ae7a&dg=microsoft.public....

deleting fonts
My computer uses Vista Home Premium. I just had to reset it to its original state. I'm trying to delete fonts, but don't have permission. I am the only user of this computer and its administrator. When I've gone into the Fonts folder Properties - Security tab, the option for Special permissions is grayed out. When I click the Advanced option ("For special permissions or advanced settings, I don't know what to do next. Can someone please walk me through how to get permission in the Fonts folder so I can delete fonts? Thanks Kelly On Wed, 6 Jan 2010 07:...

how can I get old replaced excel file
I have one A file, suddenly I have go to sav as option & select file B to replace with A I said yes, but my mistake I said yes. Please see how can I get that old A file from back date ? Use the backup copy. If you didn't create a backup last time, make sure that you do next time. In your "Save As" dialogue, "General Options" comes from the Tools option (in Excel 2007). If you didn't create a backup copy yourself, then you are out of luck unless your system (or your IT department if you have one) has created a backup, or unless you sent a cop...