Jump to content
Sign in to follow this  
Shiro

delete a file without knowing the folder name

Recommended Posts

Shiro

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?


Share this post


Link to post
Share on other sites
Yashied

#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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.