Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-03-2009
Member
 
Join Date: Jan 2009
Posts: 9
delete all .TXT files

Hello, I create a time and date stamp with a .TXT extension for 9 folders and 6 sub folders such as \1 \2 \3 \4 \5 \6 for a total of 54 folders with a time stamp.TXT

C:\WebSite\A\1 \3 \4 \5 \6
C:\WebSite\A\2
C:\WebSite\B\1

I would like to delete all the .TXT records within the structure.
I have tried many ideas without success and the last one should have worked;

Del C:\Webs\*.txt /S

Please advise me as to how to get the deletion to work?
Mehran
Reply With Quote
  #2  
Old 14-03-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: delete all .TXT files

DELETE
FROM tblRecordsWithColors
INNER JOIN tblOldCopiesOfUpdatedRecords ON tblRecordsWithColors.FILE_NBR = tblOldCopiesOfUpdatedRecords.oldFILE_NBR
WHERE (((tblRecordsWithColors. FILE_NBR)=[tblOldCopiesOfUpdatedRecords]![oldFILE_
NBR]));
Reply With Quote
  #3  
Old 14-03-2009
Member
 
Join Date: Dec 2008
Posts: 183
Re: delete all .TXT files

You may use the following the VB program to clean all your files from the system.

Code:
Option Explicit 
 
Sub cleanTxt() 
     
    Dim i As Long 
    Dim lastrow As Long 
     
     turn of screen refresh for  speed
    Application. ScreenUpdating = False 
     
     get last row of data Col A
    lastrow = Range("A65536").End(xlUp).Row 
     
     format all as general
    Range(Cells(1, 1), Cells(lastrow, 1)).NumberFormat = "General" 
     
     from lastrow to Row 1
    For i = lastrow To 1  Step -1 
         test is text or blank
        If Not IsNumeric(Cells(i, 1)) Or Cells(i, 1) = "" Then 
             delete if text or blank
            Cells(i, 1).EntireRow.Delete 
        End If 
         leave if number
    Next i 
     
     turn on screen refresh
    Application.ScreenUpdating = True 
     
End Sub
Reply With Quote
  #4  
Old 14-03-2009
Member
 
Join Date: Apr 2008
Posts: 193
Re: delete all .TXT files

To delete all the .TXT flle here is some code apply it and check whether it deletes all the .TXT file.

Code:
Option Explicit
Set fsobj = CreateObject ("Scripting.FileSystemObject")
if (fsobj.FileExists ("g:\test.txt")) then fsobj.DeleteFile ("g:\test.txt")

//rem program continues here

/*If you need to do additional tasks when you delete the file, then you use the block form of the IF statement:*/

Set fsobj = CreateObject ("Scripting.FileSystemObject")
if (fsobj.FileExists ("g:\test.txt")) then
fsobj.DeleteFile ("g:\test.txt")
rem run some additional code
end if
Reply With Quote
  #5  
Old 15-03-2009
Member
 
Join Date: Jan 2009
Posts: 9
Re: delete all .TXT files

I am sorry that I gave you the wrong idea that the data was in a table.

My data is in folders such as below;
C:\WebSite_01\FolderA\File1.txt
C:\WebSite_01\FolderB\File2.txt
C:\WebSite_01\FolderC\File1.txt
C:\WebSite_01\FolderD\File2.txt
C:\WebSite_01\FolderE\File1.txt
C:\WebSite_01\FolderF\File2.txt

C:\WebSite_02\FolderA\File1.txt and repeat the folders as above 9 times.

I would like to delete the time stamp.TXT records from all of the 54 folders.

Thank you
Mehran
Reply With Quote
  #6  
Old 16-03-2009
Member
 
Join Date: Aug 2004
Location: India
Posts: 76
Re: delete all .TXT files

Quote:
Originally Posted by Stockholm View Post
I am sorry that I gave you the wrong idea that the data was in a table.

My data is in folders such as below;
C:\WebSite_01\FolderA\File1.txt
C:\WebSite_01\FolderB\File2.txt
C:\WebSite_01\FolderC\File1.txt
C:\WebSite_01\FolderD\File2.txt
C:\WebSite_01\FolderE\File1.txt
C:\WebSite_01\FolderF\File2.txt

C:\WebSite_02\FolderA\File1.txt and repeat the folders as above 9 times.

I would like to delete the time stamp.TXT records from all of the 54 folders.

Thank you
Mehran
Can't you delete the files from folders manually? Why are you asking for help for just a silly question? If you can't do so then please mention what exactly the problem is?
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "delete all .TXT files"
Thread Thread Starter Forum Replies Last Post
Is it ok to delete setup log files and debug dump files in Disk Cleanup Ekram Operating Systems 7 04-05-2012 12:37 PM
Cannot delete MP4 files The!Winston Operating Systems 7 30-03-2012 01:44 PM
Is it possible to identify and delete the duplicate files other than the program files on Windows 7? The creeper Operating Systems 5 12-11-2011 10:22 PM
Not able to delete files in MAC Paisley007 Operating Systems 5 05-02-2010 12:53 PM
How To Delete Files Which Windows Wont Delete? Hardik Windows Software 2 06-03-2007 12:45 PM


All times are GMT +5.5. The time now is 07:57 AM.