RogueX2 Posted March 8, 2011 Share Posted March 8, 2011 The name of a particular directory/folder changes. The only part of the name that stays consistent is the last 9 characters. Can I pull the name of the dir after it is copied using dirCopy? Or do I have to work with _filelisttoarray? Link to comment Share on other sites More sharing options...
x001z Posted March 8, 2011 Share Posted March 8, 2011 Hi!! Maybe you can check the AutoIT help for FileFindFirstFile example, and use the FileChangeDir to change the working dir. Hope this help. Link to comment Share on other sites More sharing options...
kylomas Posted March 8, 2011 Share Posted March 8, 2011 Roguex2, If you can detect the name change then you can likely get the dir name. There is not enough info/code here to provide an adequate response. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
RogueX2 Posted March 9, 2011 Author Share Posted March 9, 2011 Roguex2, If you can detect the name change then you can likely get the dir name. There is not enough info/code here to provide an adequate response. kylomas Basically I am copying a folder that is the "only folder in a particular directory" over to a desktop using DirCopy("\\location\location*.*"). I would then need to open the folder that has been copied to the destkop. However since I don't know the name I can't access it. I guess I could use _filelisttoarray and the name would be in array [1]. How do I pass that value to string? Thanks Link to comment Share on other sites More sharing options...
x001z Posted March 9, 2011 Share Posted March 9, 2011 You can use wildcardsFileChangeDir(@DesktopDir)$search = FileFindFirstFile("*.") <=== search for all the directories or u can use the last 9 characters $search = FileFindFirstFile("*123456789.") <=== this will match every dir with the characters "123456789" at the end.then use the $file = FileFindNextFile($search) to get the name. Link to comment Share on other sites More sharing options...
RogueX2 Posted March 9, 2011 Author Share Posted March 9, 2011 You can use wildcardsFileChangeDir(@DesktopDir)$search = FileFindFirstFile("*.") <=== search for all the directories or u can use the last 9 characters $search = FileFindFirstFile("*123456789.") <=== this will match every dir with the characters "123456789" at the end.then use the $file = FileFindNextFile($search) to get the name.Thanks...will when I get to work this morning. Link to comment Share on other sites More sharing options...
jvanegmond Posted March 9, 2011 Share Posted March 9, 2011 (edited) You can do a search for the folder using wildcards (*) using FileFindFirstFile (also works on directories). $search = FileFindFirstFile("*LastNineChars") $dir = FileFindNextFile($search) It is necessary to add error checking in the example above. Edited March 9, 2011 by Manadar github.com/jvanegmond 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