If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#16
|
|||
|
|||
Creating a .bat file?
"Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. Kate |
Ads |
#17
|
|||
|
|||
Creating a .bat file?
Kate wrote:
"Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, * covers letters or numbers (any alpha-numeric characters) - it's a generic global parameter. and is a .bat file case-sensitive? No. I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate |
#18
|
|||
|
|||
Creating a .bat file?
Kate wrote:
"Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, Yes (as mentioned - it's a global substitute) and is a .bat file case-sensitive? No. I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. Kate I'm not sure exactly what the contents of your "erasetmp.bat" file looks like. Maybe you can copy and paste it into here. The punctuation is critical, of course. I assume you created a pure text file in *Notepad*. Don't use a word processor for this - it needs to be a pure text file. Here again is a simple one: del c:\windows\*.tmp (note: space only after the del command) would delete all .tmp files in that directory (after just double clicking on the "erasetmp.bat" file it's written in). |
#19
|
|||
|
|||
Creating a .bat file?
Kate wrote:
"Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John |
#20
|
|||
|
|||
Creating a .bat file?
"John John - MVP" wrote in message ... Kate wrote: "Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John The command prompt worked correctly, so I must be doing something wrong creating the .bat. In Notepad, I wrote del \F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp del \F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp (F: is my main drive, BTW, as you probably guessed and I am copying the path exactly as it appears in the address bar of my Temp folder) I have tried it with and without F:, with quotation marks and without (grasping at straws there), but it still doesn`t work. I also tried replacing the * with ????, targetting specific files, but to no avail. Then I thought that maybe these Interlok files are locked in some way, so I tried naming a specific log file which has nothing to do with Interlok, but that didn`t erase either. I cannot see where I am going wrong! Thanks Kate |
#21
|
|||
|
|||
Creating a .bat file?
Kate wrote:
"John John - MVP" wrote in message ... Kate wrote: "Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John The command prompt worked correctly, so I must be doing something wrong creating the .bat. In Notepad, I wrote del \F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp del \F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp Don't use the first forward slash in the path and use the quotation marks, try it *exactly* like this: del "F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp" del "F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp" John |
#22
|
|||
|
|||
Creating a .bat file?
"John John - MVP" wrote in message ... Kate wrote: "John John - MVP" wrote in message ... Kate wrote: "Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John The command prompt worked correctly, so I must be doing something wrong creating the .bat. In Notepad, I wrote del \F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp del \F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp Don't use the first forward slash in the path and use the quotation marks, try it *exactly* like this: del "F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp" del "F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp" John YeeHa! It worked! Thank you very much indeed, John. Kate |
#23
|
|||
|
|||
Creating a .bat file?
While this thread has been going on I have cleaned out my temp folders
142 times. --- Leonard "The Troublemaker" Grey Errare humanum est John John - MVP wrote: Kate wrote: "John John - MVP" wrote in message ... Kate wrote: "Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John The command prompt worked correctly, so I must be doing something wrong creating the .bat. In Notepad, I wrote del \F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp del \F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp Don't use the first forward slash in the path and use the quotation marks, try it *exactly* like this: del "F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp" del "F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp" John |
#24
|
|||
|
|||
Creating a .bat file?
Kate wrote:
YeeHa! It worked! Thank you very much indeed, John. You're welcome. Just a reminder that you have to be extremely careful when using wildcards to delete files! It might not matter too much with temp files but with any other files this can be like dynamite! John |
#25
|
|||
|
|||
Creating a .bat file?
Erm...what about creating a batch file, Leonard? ;-)
Kate "Leonard Grey" wrote in message ... While this thread has been going on I have cleaned out my temp folders 142 times. --- Leonard "The Troublemaker" Grey Errare humanum est John John - MVP wrote: Kate wrote: "John John - MVP" wrote in message ... Kate wrote: "Kate" wrote in message ... "Bill in Co." wrote in message ... Kate wrote: "Bill in Co." wrote in message ... Kate wrote: XP Home SP3 Apologies if this is not the place to ask this question, but I would like to create a .bat file or something to delete the dozens of temp files which a program I have leaves in my Temp folder every time I run it. The files are always named in a particular way so can easily be identified, I think/hope. I do not want to delete all of the files in the Temp folder, though. Is this possible, please, and how would I go about it? Many thanks Kate The syntax for doing something like that is like this: del \windows\temp\trb*.tmp (In this example we'd be referring to the \windows\temp folder). This would delete all .tmp files in that folder beginning with trb You simply put that line above into a text file created with Notepad, and rename that text file with a .bat extension. You could call it erasetmp.bat. Might this work, do you think? del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp As already mentioned, you need to add a space after del command. Also, make it t*.tmp in the batch file (just one asterisk is allowed). An alternate command would be t?????.tmp, but that's not needed here, but that would specifically ONLY delete filenames (with t, followed by 5 alphanumeric prefixes). The * is more global: t*.tmp will delete any filename ending in .tmp that starts with the letter t. Does that mean the * can be letters and/or numbers, and is a .bat file case-sensitive? I have some TWAIN and Twunk files in my Temp folder and although it doesn`t really matter if they are deleted as they are re-created when I next use my scanner, it would be more...elegant... if the instructions could be targetted at just the Interlok files. The .tmp files always have numbers and/or letters after the PTM or t so I have used asterisks as wild-cards. Perhaps more importantly, if it doesn`t work, can an incorrectly executed .bat file cause problems elsewhere, do you know? Well, if you really messed it up, you could delete some other files you hadn't intended if they matched the conditions specified in the batch file, which seems unlikely. I know these files are useless after the program is closed as I have been manually deleting them without ill-effects after each closure. Most of the other files in my Local Settings/Temp folder are things which just get re-created if I do delete them (see above), so I tend to leave them alone. I think I will give the .bat file a try and see how it goes. I suspect that if it works well, there will be quite a few DxO Optics users celebrating, as it isn`t just me that finds these Interlok files a PITA. Thanks again to all. Kate It didn`t work. In fact, nothing beginning with a P or t (or even a p or a T!) is being deleted, although I have checked the wording most carefully and it all seems to be correct. Oh well, it looks like I shall have to manually delete them after all. Disappointing. It should work, I think that you're doing something wrong. Experiment with it at the Command Prompt using the DIR command and see what the command returns: dir /b c:\"folder name\p*.tmp" If the DIR command returns a proper list of files that you want to delete then then there is no reason why the DEL command shouldn't delete them. Remember that if there are spaces in the path or file names that you *must* encapsulate the path with "quotation marks" (as above) or else the command will fail. John The command prompt worked correctly, so I must be doing something wrong creating the .bat. In Notepad, I wrote del \F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp del \F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp Don't use the first forward slash in the path and use the quotation marks, try it *exactly* like this: del "F:\Documents and Settings\(user name)\Local Settings\Temp\p*.tmp" del "F:\Documents and Settings\(user name)\Local Settings\Temp\t*.tmp" John |
#26
|
|||
|
|||
Creating a .bat file?
"John John - MVP" wrote in message ... Kate wrote: YeeHa! It worked! Thank you very much indeed, John. You're welcome. Just a reminder that you have to be extremely careful when using wildcards to delete files! It might not matter too much with temp files but with any other files this can be like dynamite! John Yes, indeed! I do not know if you were around in the days of Win 98SE, but there was one charming poster to the ms help and support NG who used to reply to pleas for help with the instruction to use the deltree y command, saying that all the OP`s problems would be solved if they ran it. Fortunately, I never got caught, but all the warnings which were posted at the time have made me cautious about any "del" command. Thank you for the warning, though. Kate |
#27
|
|||
|
|||
Creating a .bat file?
Leonard Grey wrote:
While this thread has been going on I have cleaned out my temp folders 142 times. --- Surely you jest, Leonard! The thread's just 24 hours old. Kate's right. You could use a batch file... Bill |
#28
|
|||
|
|||
Creating a .bat file?
I`m glad you posted, Bill, because it has given me a chance to ask
for more help, please? The same program that I have been grumbling about puts a "Hidden" folder in my Documents and Settings\(user)\Cookies folder. Because I have "Show Hidden Files & Folders" checked, I am able to see it, but cannot delete it using the line del "F:\Documents and Settings\(user)\Cookies\(folder name)" The contents of the folder are deleted, but not the folder. What sort of wording should I use to delete the folder itself and its contents, please? Many thanks Kate "Bill Sharpe" wrote in message .. . Leonard Grey wrote: While this thread has been going on I have cleaned out my temp folders 142 times. --- Surely you jest, Leonard! The thread's just 24 hours old. Kate's right. You could use a batch file... Bill |
#29
|
|||
|
|||
Creating a .bat file?
Au contraire, Bill. Since it takes less than 3 seconds for me to click
twice on CCleaner, I could have cleared my temp files thousands of times in a 24-hour period. And as you'll soon find out, this thread is still not over. ;-) --- Leonard Grey Errare humanum est Bill Sharpe wrote: Leonard Grey wrote: While this thread has been going on I have cleaned out my temp folders 142 times. --- Surely you jest, Leonard! The thread's just 24 hours old. Kate's right. You could use a batch file... Bill |
#30
|
|||
|
|||
Creating a .bat file?
Use the RD command.
rd /s /q "F:\Documents and Settings\(user)\Cookies\(folder name)" At the Command Prompt do RD /? for information on the switches. John Kate wrote: I`m glad you posted, Bill, because it has given me a chance to ask for more help, please? The same program that I have been grumbling about puts a "Hidden" folder in my Documents and Settings\(user)\Cookies folder. Because I have "Show Hidden Files & Folders" checked, I am able to see it, but cannot delete it using the line del "F:\Documents and Settings\(user)\Cookies\(folder name)" The contents of the folder are deleted, but not the folder. What sort of wording should I use to delete the folder itself and its contents, please? Many thanks Kate "Bill Sharpe" wrote in message .. . Leonard Grey wrote: While this thread has been going on I have cleaned out my temp folders 142 times. --- Surely you jest, Leonard! The thread's just 24 hours old. Kate's right. You could use a batch file... Bill |
Thread Tools | |
Display Modes | |
|
|