Hutch1981 Posted May 10, 2011 Share Posted May 10, 2011 First off I am new to autoit and scripting. I have to migrate files from office 2003 format to office 2010. I am going to use OMPM and in the end I am going to have a folder of converted Office 2003 files with the office 2010 format so the file extensions are going to change. My thing is I want to move the files from the converted folder to the source folder and purge out all the old office 2003 files that the file name matches excluding the file extension. Example in a folder there will be multiple files but only 1 with same file name... Test.doc and Test.docx I need to remove only the test.doc from the dir and sub directories if other file names matchs other files. File extensions of files that will need to be purged if another file has the same name. xls,xlt,xla,XLC,XLM ppt,pot,pps,ppa doc,dot,wiz Any help on this would be great or being able to point me in the right direction. Thank you. Link to comment Share on other sites More sharing options...
GEOSoft Posted May 10, 2011 Share Posted May 10, 2011 This is pretty basic but it will give you the general idea. Use FileChangeDir() to change the working folder to the folder containing the files you want to replace. $sFile = "Test.doc" If FileExists("$sFile") AND FileExists("path\test.docx") Then FileDelete($sFile) FileCopy("path\test.docx", "test.docx") EndIf I don't remember all the file extension changes involved but personally I would just copy them all over and then use a loop to test for and delete the files that need purging. And I would probably do it with a RegExp to test for the duplicates. Like I said, this is all just generaality. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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