Results 1 to 3 of 3

Thread: [RESOLVED] deleting files/folders

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Resolved [RESOLVED] deleting files/folders

    does the 'kill' cmmand work for both files and folders??

    Kill "C:\test.txt"

    Kill "C:\folder1"

    so the 2nd one would remove the folder1 alltogether?

  2. #2
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: deleting files/folders

    Yes, but that won't send it to the recycle bin. If you want to then do this

    VB Code:
    1. Private Type SHFILEOPTSTRUCT
    2.   hwnd As Long
    3.   wFunc As Long
    4.   pFrom As String
    5.   pTo As String
    6.   fFlags As Integer
    7.   fAnyOperationsAborted As Long
    8.   hNameMappings As Long
    9.   lpszProgressTitle As Long
    10. End Type
    11.  
    12. Private Declare Function SHFileOperation Lib "shell32.dll" _
    13.   Alias "SHFileOperationA" (lpFileOp As SHFILEOPTSTRUCT) As Long
    14.  
    15. Private Const FO_DELETE = &H3
    16. Private Const FOF_ALLOWUNDO = &H40
    17.  
    18. Private Sub cmdDel_Click()
    19.     DeleteFileToRecycleBin (Desired Location)
    20. End Sub
    21.  
    22. Public Sub DeleteFileToRecycleBin(Filename As String)
    23.     Dim fop As SHFILEOPTSTRUCT
    24.     With fop
    25.       .wFunc = FO_DELETE
    26.       .pFrom = Filename
    27.       .fFlags = FOF_ALLOWUNDO
    28.     End With
    29.     SHFileOperation fop
    30. End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: [RESOLVED] deleting files/folders

    but also is:

    Kill ("C:\MyTrashFiles")

    same as..

    Kill ("C:\MYTRASHFILES")

    ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width