PC Applications forum

General discussion

Delete all .TXT files in sub folders

Hello, I create a time and date stamp record with a .TXT extension for 9 folders and 6 sub folders on a windows 2000 O/S such as below for a total of 54 folders each of which has a time stamp.TXT record

My data is in folders such as below;
C:\WebSite_01\FolderA\TimeFileA.txt
C:\WebSite_01\FolderB\TimeFileB.txt
C:\WebSite_01\FolderC\TimeFileC.txt
C:\WebSite_01\FolderD\TimeFileD.txt
C:\WebSite_01\FolderE\TimeFileE.txt
C:\WebSite_01\FolderF\TimeFileF.txt

Than repeat the folders as above 9 times [ C:\WebSite_02\FolderA\TimeFileA.txt ]

I would like to delete the time stamp.TXT records from all of the 54 folders and sub folders and have tried the following batch file without success

Del C:\Webs\*.txt /S

Please advise me how to get the deletion of all the records that have an extension of .TXT to work?
Mehran

Discussion is locked
You are posting a reply to: Delete all .TXT files in sub folders
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Delete all .TXT files in sub folders
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
You didn't say which OS.

In reply to: Delete all .TXT files in sub folders

For Vista I ran smack dab into this until I opened an elevated prompt.

I can't know if you run Vista or not.

-> You mention TIME STAMP. Do you remember "DOS FILE TUNNELING"? If not, please research that as this is why TIME STAMPS on files survive when you delete and create a file quickly. The FILE TUNNELING TIME is settable in the registry but I'll stop here since you have 2 answers and a direction for your research.
Bob

Collapse -
Batch delete

In reply to: You didn't say which OS.

An other person has sent me the following note which I will follow.

Windows 2000 does not support the regular expression operator in directory names, so you'll need to write it out for all 9 directories.

Thanks

Collapse -
Just in case...

In reply to: Delete all .TXT files in sub folders

In one place you wrote website, the next webs.

Collapse -
The problem is...

In reply to: Delete all .TXT files in sub folders

You told it to delete all TXT files in the directory C:\Webs (and subdirectories) whereas you intended to have it delete all TXT files in all directories located in C:\ that begin with Webs and all subdirectories thereof. Windows 2000 does not support the regular expression operator in directory names, so you'll need to write it out for all 9 directories:

del C:\WebSite_01\*.txt /s
del C:\WebSite_02\*.txt /s
...etc...

John

Collapse -
Batch file delete

In reply to: The problem is...

Thank you for your suggestion, which I will use.

Collapse -
One line solution.

In reply to: Delete all .TXT files in sub folders

C:\>for %n in (1 2 3 4 5 6 7 8 9) do del c:\website0%n\*.txt /s

C:\>del c:\website01\*.txt /s
The system cannot find the file specified.

C:\>del c:\website02\*.txt /s
The system cannot find the file specified.

C:\>del c:\website03\*.txt /s
The system cannot find the file specified.

C:\>del c:\website04\*.txt /s
The system cannot find the file specified.

C:\>del c:\website05\*.txt /s
The system cannot find the file specified.

C:\>del c:\website06\*.txt /s
The system cannot find the file specified.

C:\>del c:\website07\*.txt /s
The system cannot find the file specified.

C:\>del c:\website08\*.txt /s
The system cannot find the file specified.

C:\>del c:\website09\*.txt /s
The system cannot find the file specified.

C:\>(fin)

Sorry if I brought file tunneling but you wrote time stamps which may survive deletion for a time.

The reason the command shows cannot find is because I don't have the files to delete.
Bob

Collapse -
Delete

In reply to: One line solution.

Thank you for trying to help me, but I have wrote a new batch file to delete each folder's .txt records.

Popular Forums

icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

DEALS, DEALS, DEALS!

Best Black Friday Deals

CNET editors are busy culling the list and highlighting what we think are the best deals out there this holiday season.