Erlend Posted June 3, 2008 Share Posted June 3, 2008 Hello i have a directory that contains files from a web service, in this directory all the filees from the webservice is stored. when a users submits a form on the websites, the form and attachements are store here. When the users submits the form the following files are trasfered to the folder: 1.xml file with form id information etc. 2.PDF file with information 3.Attachment any kind of extension. i need to search this folder for the name of the .xml files, and check if a pdf files exist with the same name, and if the pdf files dosn't exist the xml files and attachment's with the same name should be deleted. i don't know where to start, if somone could point me in the right direction it would be super Erlend Link to comment Share on other sites More sharing options...
d4rk Posted June 3, 2008 Share Posted June 3, 2008 (edited) Don't know if this work correctly, but at least it gives you a right direction (or at least i think so) ... #include <Array.au3> #include <File.au3> Dim $XmlNames,$PdfNames $XmlFiles=_FileListToArray("C:","*.*",1);file only _ArrayDisplay($XmlFiles,"") for $i=1 to UBound($XmlFiles)-1 if StringInStr($XmlFiles[$i],".xml",2)<>0 Then $XmlNames=StringReplace($XmlFiles[$i],".xml","");Name of Xml files EndIf $PdfFiles=_FileListToArray("C:","*.*") for $j=1 to UBound($PdfFiles)-1 if StringInStr($PdfFiles[$j],".pdf",2)<>0 Then $PdfNames=StringReplace($PdfFiles[$j],".pdf","");Name of Pdf files EndIf if $XmlNames <> $PdfNames Then FileDelete("C:\" & $XmlNames & ".xml") FileDelete("C:\" & $XmlNames & ".*") EndIf Next Next P/s : I lose 2 of my au3 file while testing this script Edited June 3, 2008 by d4rk [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Erlend Posted June 3, 2008 Author Share Posted June 3, 2008 Thanks for the reply, sorry about your au3 files.. Link to comment Share on other sites More sharing options...
Erlend Posted June 3, 2008 Author Share Posted June 3, 2008 Hello This seems to delete all the xml files both when the pdf files exist and when they don't. the xml files and the other files (doc, xls) should be deleted only if it Dont exist a pfd file with the sanme name as the xml file and attachment files. thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now