styles3000 Posted November 6, 2009 Posted November 6, 2009 Sup Fellas, I need a little help. A buddy of mine helped me write these two functions. The first function is to go into a folder and count the files for me. Which it does. The second function is primarily for transferring a .htm called "HOME-MASTER-PHP.htm" and changing the name to index.htm in the process. What I'm In Need Of....... I no longer need function 2 to "DirCreate", rather , or nor do I need the name changed to index.htm and longer, what I need it to do is to go to D:\Documents and Settings\Taevon Jones\Desktop\PAGE-MASTER-PHP.....copy it, then go to 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages' folder taking the number that was counted in Function 1($sTotalFiles) and paste there. So if $sTotalFiles was 8, I need 8 copies of PAGE-MASTER-PHP's. If $sTotalFiles was 10, I need 10 copies of PAGE-MASTER-PHP's. If $sTotalFiles was 15, I need 15 copies of PAGE-MASTER-PHP's. Etc.....etc. Function 1 $sTotalFiles = _GetFileCount("D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\") MsgBox(0,'Total Files',$sTotalFiles) Func _GetFileCount($Directory) Local $sTotalFiles = 0 $search = FileFindFirstFile($Directory&"*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $attrib = FileGetAttrib($Directory&$file) If StringInStr($attrib,"D") < 1 Then $sTotalFiles = $sTotalFiles+1 EndIf WEnd FileClose($search) Return $sTotalFiles EndFunc Function 2 $Firstline = 'christmas greetings' DirCreate('D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline) FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm', _ 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline&'\index.htm',8)
Authenticity Posted November 6, 2009 Posted November 6, 2009 (edited) For $i = 1 To $sTotalFiles FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm', _ 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline& $i & '\index.htm',8) Next For multiple folders or: For $i = 1 To $sTotalFiles FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm', _ 'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline& '\index' & $i & '.htm',8) Next ..for multiple files in the same folder. Files are index1.htm, index2.htm, etc... Edited November 6, 2009 by Authenticity
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