Jump to content

delete a file without knowing the folder name


Recommended Posts

hello

i have some files in a directory on desktop.

c:\Documents and Settings\Shiro\Desktop\Unknown_Folder\ (Files in this directory)

but the problem is that i know files names but not the directory name.

i want to delete 2 files in a directory on desktop.

File names are "Old1.xls" & "old2.xls"

like this

c:\Documents and Settings\Shiro\Desktop\Unknown_Folder\Old1.xls

c:\Documents and Settings\Shiro\Desktop\Unknown_Folder\Old2.xls

how can i do it?

Link to comment
Share on other sites

#Include <File.au3>

$Dir = _FileListToArray(@DesktopDir, '*', 2)
If Not @error Then
    For $i = 1 To $Dir[0]
        For $j = 1 To 2
;           FileDelete(@DesktopDir & '\' & $Dirs[$i] & '\Old' & $j & '.xls')
        Next
    Next
EndIf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...