quicksilver Posted January 11, 2006 Share Posted January 11, 2006 Hi i Have files like this names:LP2001060000N_00N.txtLP2001060000N_00N.pdfLP2001060000N_00N.idxLP2001060000N_00N.rdyin the folder are over 20.000 files and i want to move all the files with the same Year and Month (LP2001060000N_00N.rdy) in separate folders like 2001_06. I want that the script create these folders and move all the files into the specified folder .Can Anyone Help me with this problem? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 Errr... what do you have so far? 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...
quicksilver Posted January 11, 2006 Author Share Posted January 11, 2006 At the moment nothing.. because i dont know how to scan all the files and extract the year and month and create a folder Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 (edited) Do all the files start with LP? Do all the files after the month have 0000? Can you post absolute filename examples that you would be dealing with...? Edit: How far back do the files go? Edited January 11, 2006 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...
quicksilver Posted January 11, 2006 Author Share Posted January 11, 2006 Start Charakters are LP, MW or RG Yes 4 Zero's after the date. The Filename Examples are absolute. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 11, 2006 Moderators Share Posted January 11, 2006 (edited) Start Charakters are LP, MW or RG Yes 4 Zero's after the date. The Filename Examples are absolute. If StringInStr($FileName, 'LP') Then If Not StringInStr($NewFolder, _StringBetween($FileName, 'LP', '0000')) Then $NewFolder = $NewFolder & _StringBetween($FileName, 'LP', '0000') & Chr(01) EndIf ElseIf StringInStr($FileName, 'MW') Then If Not StringInStr($NewFolder, _StringBetween($FileName, 'MW', '0000')) Then $NewFolder = $NewFolder & _StringBetween($FileName, 'MW', '0000') & Chr(01) EndIf ElseIf StringInStr($FileName, 'RG') Then If Not StringInStr($NewFolder, _StringBetween($FileName, 'RG', '0000')) Then $NewFolder = $NewFolder & _StringBetween($FileName, 'RG', '0000') & Chr(01) EndIf EndFunc Func _StringBetween($s_String, $s_Start, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start)+StringLen($s_Start) return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End)-$s_Start) EndFunc At the end of your search, or where ever you'll notice that the folder names are seperated by Chr(01), you can use this as the delimeter to create an array and make a folder either after your search is finished, or during the search if you are moving the files at the same time. Edit: Sometimes coding when your tired... you do things ass Backwards ... fixed a StringInStr() issue!! Edited January 11, 2006 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...
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