qassam Posted December 15, 2014 Share Posted December 15, 2014 hello all ... i want to write a code do the following : 1-find all drivers in windows 2-search all drivers for any *.jpg files and then copy all of them ( founded files in all drivers to some folder created by me ) i dont now how to do this please help me i read some topics about _FileListToArray but i didnt understand how to make a copy after search and put all files in some folder in my desktop ..... etc help me please >>>> regards Link to comment Share on other sites More sharing options...
MikahS Posted December 15, 2014 Share Posted December 15, 2014 (edited) The place you need to look to find your drivers, if your on win 7 (let me know if this is different) is: C:\Windows\System32\DriverStore Local $path ="C:\Windows\System32\DriverStore", $filter = "*.jpg" _FileListToArray($path, $filter, 1) That will list your files like so Return Value Success: A one-dimensional array. $aArray[0] = Number of FilesFolders returned $aArray[1] = 1st FileFolder $aArray[2] = 2nd FileFolder $aArray[3] = 3rd FileFolder $aArray[n] = nth FileFolder Then you'll need to use FileMove or FileCopy after you have used DirCreate to make the folder. This can be done with a for loop on the number of files read with $aArray[0]. Give it a try and if you have any questions post them. Edited December 15, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
qassam Posted December 15, 2014 Author Share Posted December 15, 2014 The place you need to look to find your drivers, if your on win 7 (let me know if this is different) is: C:\Windows\System32\DriverStore Local $path ="C:\Windows\System32\DriverStore", $filter = "*.jpg" _FileListToArray($path, $filter, 1) That will list your files like so Return Value Success: A one-dimensional array. $aArray[0] = Number of FilesFolders returned $aArray[1] = 1st FileFolder $aArray[2] = 2nd FileFolder $aArray[3] = 3rd FileFolder $aArray[n] = nth FileFolder Then you'll need to use FileMove or FileCopy after you have used DirCreate to make the folder. This can be done with a for loop on the number of files read with $aArray[0]. Give it a try and if you have any questions post them. im sorry man i didn't understand what is the relationship between C:WindowsSystem32DriverStore and my topic !! Link to comment Share on other sites More sharing options...
Moderators Solution SmOke_N Posted December 15, 2014 Moderators Solution Share Posted December 15, 2014 (edited) You really need to post what you've tried thus far. This isn't a "write code for me because I've said I've tried" type of forum. Here is pseudo code to help get you started. #include <File.au3> Global $szMyDir = "Drive:\MyDesktop\MyFolder" ; ensure my "to" folder exist If Not FileExists($szMyDir) Then DirCreate($szMyDir) ; get a list of all drives on computer Global $gaDrives = DriveGetDrive("ALL") If Not IsArray($gaDrives) Then MsgBox(16 + 262144, "Error", "Could not get drives!") Exit EndIf ; loop through drives and use recursive search to ; loop through all folders in that drive to find match Global $gaJPGList = 0 For $iDrives = 1 To UBound($gaDrives) - 1 $gaJPGList = _FileListToArrayRec($gaDrives[$iDrives], "*.jpg", $FLTAR_FILES, $FLTAR_RECUR, Default, $FLTAR_FULLPATH) If Not @error Then For $iPic = 1 To UBound($gaJPGList) - 1 FileCopy($gaJPGList[$iPic], $szMyDir) Next EndIf Next Edit: Be prepared to wait forever for code to finish. Never just run code on your PC unless you know exactly what it is doing. Edit2: Oops, I had DirCopy instead of FileCopy, that's what I get for typing in this window instead of SciTe lol, fixed above. And Edit3: You want to return all files, changed 3rd param of _FileListToArrayRec() to represent that... And I'm done now... Good Luck Edited December 15, 2014 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MikahS Posted December 15, 2014 Share Posted December 15, 2014 1-find all drivers in windows im sorry man i didn't understand what is the relationship between C:WindowsSystem32DriverStore and my topic !! It's where all the drivers are located on the system. You asked me where the drivers were located, is this not your actual question? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2014 Moderators Share Posted December 15, 2014 (edited) Eh, I believe he means from all drives.... Edited December 15, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MikahS Posted December 15, 2014 Share Posted December 15, 2014 (edited) It's a little hard to understand when they said drivers 3 times..... EDIT: if you can understand that you did not mean drivers, why not fix it? That was a rhetorical question. SmOke_N's answer will do the job for you. Edited December 15, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2014 Moderators Share Posted December 15, 2014 Language is obviously a barrier, but in looking at context, I don't think I've ever known anyone to ask for .jpg files embedded inside drivers. It isn't that far a leap... TheSaint 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
iamtheky Posted December 15, 2014 Share Posted December 15, 2014 All that aside. What happened to expecting effort and teaching someone to fish? Must be getting close to Christmas. mLipok 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 15, 2014 Moderators Share Posted December 15, 2014 All that aside. What happened to expecting effort and teaching someone to fish? Must be getting close to Christmas. Indeed... that was a "give a dog a bone" type moment. mLipok 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2014 Moderators Share Posted December 15, 2014 Agreed, boththose, but I think we've all had those moments "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
iamtheky Posted December 15, 2014 Share Posted December 15, 2014 that, and Smoke_N's pseudo code puts my actual code to shame ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
MikahS Posted December 15, 2014 Share Posted December 15, 2014 Language is obviously a barrier, but in looking at context, I don't think I've ever known anyone to ask for .jpg files embedded inside drivers. It isn't that far a leap... Very true. My apologies. JLogan your quote made me laugh after this. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
qassam Posted December 16, 2014 Author Share Posted December 16, 2014 It's a little hard to understand when they said drivers 3 times..... EDIT: if you can understand that you did not mean drivers, why not fix it? That was a rhetorical question. SmOke_N's answer will do the job for you. im sorry for my bad lang. Drivers mean : C: , D: , E: etc .... i used this code : #include <MsgBoxConstants.au3> qan() Func qan() local $filter = ( "*.jpg*" ) local $drivers = DriveGetDrive("all") Local $hSearch = FileFindFirstFile( $filter ) local $sFileName = FileFindNextFile($hSearch) Local $sFileName = "", $iResult = 0 While 1 $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop ; Display the file name. $iResult = MsgBox(BitOR($MB_SYSTEMMODAL, $MB_OKCANCEL), "", "File: " & $sFileName , $drivers ) If $iResult <> $IDOK Then ExitLoop ; If the user clicks on the cancel/close button. WEnd ; Close the search handle. FileClose($hSearch) EndFunc ;==>Example but its only gives me .jpg on desktop directory ( where i saved the script ) any idea ?? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 16, 2014 Moderators Share Posted December 16, 2014 Why are you not using the code SmOke_N gave you? He handed you exactly what you need to complete the task. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
MikahS Posted December 16, 2014 Share Posted December 16, 2014 im sorry for my bad lang. Drivers mean : C: , D: , E: etc .... No problem, but its Drives not Drivers. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
TheSaint Posted December 16, 2014 Share Posted December 16, 2014 Watch out for Drivers with Jpegs, They are a bugger to get out, if you don't stay clear and get hooked. P.S. Sorry, I couldn't resist. A sense of humor ... me ... you must be joking. MikahS 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
MikahS Posted December 16, 2014 Share Posted December 16, 2014 I took it at face value, and I am a literalist sometimes. I mean... this is the internet. ha Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
qassam Posted December 29, 2014 Author Share Posted December 29, 2014 You really need to post what you've tried thus far. This isn't a "write code for me because I've said I've tried" type of forum. Here is pseudo code to help get you started. #include <File.au3> Global $szMyDir = "Drive:\MyDesktop\MyFolder" ; ensure my "to" folder exist If Not FileExists($szMyDir) Then DirCreate($szMyDir) ; get a list of all drives on computer Global $gaDrives = DriveGetDrive("ALL") If Not IsArray($gaDrives) Then MsgBox(16 + 262144, "Error", "Could not get drives!") Exit EndIf ; loop through drives and use recursive search to ; loop through all folders in that drive to find match Global $gaJPGList = 0 For $iDrives = 1 To UBound($gaDrives) - 1 $gaJPGList = _FileListToArrayRec($gaDrives[$iDrives], "*.jpg", $FLTAR_FILES, $FLTAR_RECUR, Default, $FLTAR_FULLPATH) If Not @error Then For $iPic = 1 To UBound($gaJPGList) - 1 FileCopy($gaJPGList[$iPic], $szMyDir) Next EndIf Next Edit: Be prepared to wait forever for code to finish. Never just run code on your PC unless you know exactly what it is doing. Edit2: Oops, I had DirCopy instead of FileCopy, that's what I get for typing in this window instead of SciTe lol, fixed above. And Edit3: You want to return all files, changed 3rd param of _FileListToArrayRec() to represent that... And I'm done now... Good Luck thanks boss it's working 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