![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4
![]() |
remove();
Is it possible to use a wild card "*" (believe that is what it is called) with in the remove function?
Ex. remove( "C:\\Documents and Settings\\username\\Favorites\\*.htm" ); Thanks in advance. -BB98
__________________
Learning to use C++ and loving every minute of it. |
|
|
|
|
|
#2 | |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 211
Rep Power: 3
![]() |
Quote:
-MBirchmeier |
|
|
|
|
|
|
#3 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 3
![]() |
No, wildcards are the function of your shell, not the C runtime environment. If you want the shell to translate wildcards, you would be better off doing the equivalent shell command with the system function. Then, the command interpreter will do it's thing (if it's accessible).
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4
![]() |
Would you mind explaining that alittle farther Narue? How can I create a shell command using the system function?
Thanks, -BB98
__________________
Learning to use C++ and loving every minute of it. |
|
|
|
|
|
#5 | |
|
Hobbyist Programmer
Join Date: Oct 2005
Posts: 211
Rep Power: 3
![]() |
Quote:
ystem() passes a string to the operating system and lets the OS run the command correctlyAssuming you're using windows : System("del C:\\Documents and Settings\\username\\Favorites\\*.htm"); *nix : System("rm \\Documents and Settings\\username\\Favorites\\*.htm"); should do the trick, however this will execute the command then only return if the command executed properly (or the command's error code). Another solution is to find a filestructure object, and utilize that, so you can see more and do 'smart deletes'. I believe such structures exist in <dos.h>. But again that's operating system dependant, and I have reservations against dos.h anyway. Hope this helps. -MBirchmeier |
|
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4
![]() |
Yeah, that should get me going. Thanks, and I am using Windows.
-BB98
__________________
Learning to use C++ and loving every minute of it. |
|
|
|
|
|
#7 | |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4
![]() |
Quote:
del C:\Documents and Settings\username\Local Settings\Temporary Internet Files\*.txt I am trying to create a cache clearing utility, to remove cookies, temp files, etc. thanks, -BB98
__________________
Learning to use C++ and loving every minute of it. |
|
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You have to watch out for spaces in a directory or file name, otherwise the parts of the name are picked up as separate tokens. Careful attention is required in quoting for the shell.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 |
|
Professional Programmer
|
This cleans out all temp files (worked for me on WinXp) including temp internet files and h istory
system("DEL /F /S %TEMP%");Put in /Q if you don't want the command prompt to ask you are you sure.
__________________
The world's first athletic computer geek! The home of PrProgramsStudios How not to post a question: <-- Please don't reply |
|
|
|
|
|
#10 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4
![]() |
Prm753,
Thanks, I'll give it a try and see what happens. -BB98
__________________
Learning to use C++ and loving every minute of it. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|