phatzilla Posted January 13, 2008 Share Posted January 13, 2008 Okay say i have a file in a random folder:C:\Phatzilla\ABCDEHELLOWORLD\me.jpg (The random folder being "ABCDEHELLOWORLD")Now, i want to extract this jpg file from the random folder WITHOUT extracting the entire folder, but the problem is i have no idea what the folder is called EXCEPT FOR THE FACT THAT I KNOW THE FOLDER NAME CONTAINS "HELLOWORLD".If i knew what the folder was called i could simply type:FileCopy("C:\Phatzilla\ABCDEHELLOWORLD\me.jpg", "C:\mydir\).So is there any way i can access this folder by only knowing a CERTAIN string contained in it? Any workarounds? I really only need the .jpg file within the folder, not the entire folder but i dont know the name of the folder (haha).Thanks. Link to comment Share on other sites More sharing options...
Zedna Posted January 13, 2008 Share Posted January 13, 2008 ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("*HELLOWORLD") ; Check if the search was successful 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 ;~ MsgBox(4096, "File:", $file) FileCopy("C:\Phatzilla\" & $file & "\me.jpg", "C:\mydir\") WEnd ; Close the search handle FileClose($search) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
phatzilla Posted January 13, 2008 Author Share Posted January 13, 2008 (edited) Hmmm, doesn't seem to be working. It just says file/directory not found. edit: okay it has to be the working directory, got it. Edited January 13, 2008 by phatzilla Link to comment Share on other sites More sharing options...
phatzilla Posted January 13, 2008 Author Share Posted January 13, 2008 Thanks alot, Zedna. Is that what the * is used for? Link to comment Share on other sites More sharing options...
The Kandie Man Posted January 13, 2008 Share Posted January 13, 2008 Thanks alot, Zedna.Is that what the * is used for?The asterik is a wildcard that means that any combination of numbers, letters, or symbols can be placed before HELLOWORLD and it will still match it.- The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
GEOSoft Posted January 13, 2008 Share Posted January 13, 2008 Thanks alot, Zedna.Is that what the * is used for?Yes. The "*" is a wildcard that will match any string. "?" will match any single character. It's in the help file under wildcards. remember that some functions do not support wildcards. 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