anybastard Posted October 13, 2010 Share Posted October 13, 2010 Hi guys , i need to save files from folder with variable name . For example: .from c:\mydirectory\myfolder_Tom\*.* to c:\windows\destination folderthe problem is folder name (myfolder_Tom) , becouse i can have same folder but with different name from c:\mydirectory\myfolder_Jerry\*.* to c:\windows\destination folderMy question is , could i make a little script to copy all in this way ?from c:\mydirectory\myfolder_*\*.* to c:\windows\destination folderPlease , help me with link , code or other suggestion Thank so much for your collaboration Regards Anyb Link to comment Share on other sites More sharing options...
JohnOne Posted October 13, 2010 Share Posted October 13, 2010 Heres a little start, that might help you begin.Global $aUsers[2] = ["myfolder_Tom", "myfolder_Jerry"] ; Array of user folders _MyCopyFunction($aUsers) Func _MyCopyFunction($aNames) Local $sPath = "c:\mydirectory\" ; Your path For $i = 0 To UBound($aNames) -1 ; 0 to amount of user folders in array _DoSomethingWith($sPath & $aNames[$i]) ; process your folder Next EndFunc Func _DoSomethingWith($sUserpath) ;code EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 13, 2010 Share Posted October 13, 2010 Another way, using a wildcard to search for the folders: #include <File.au3> $sSrc = "c:mydirectory" $sSearch = "myfolder_*" $sDest = "c:\windows\destination" $aDirs = _FileListToArray($sSrc, $sSearch, 2) ; 2 = Folders only For $n = 1 To $aDirs[0] DirCreate($sDest & "\" & $aDirs[$n]) DirCopy($sSrc & "\" & $aDirs[$n], $sDest & "\" & $aDirs[$n], 1) Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
anybastard Posted October 13, 2010 Author Share Posted October 13, 2010 Hi guys , thanks for your prompt help Today morning i will try your solution and share with us my feedback Regards AnyB Link to comment Share on other sites More sharing options...
anybastard Posted October 14, 2010 Author Share Posted October 14, 2010 Good morning guys .all work fine....thank for that !!and if possible last help how to rename this folder ( with variable name ) in to other name example from c:\windows\Myfolder x to c:\windows\dukex is the variable Thank so much AnyB 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