shay Posted April 22, 2009 Posted April 22, 2009 (edited) Hi all i`m having problem copying files from multiple folders main directory named "logs" all sub folders start with "log...." and the files that i need to copy have the same name in every so i have to rename them folder example: -logs (main dir) -log.1234 (sub folders) -log.1235 (sub folders) -log.1236 (sub folders) how can i find the file and mass rename it (cause the have same name)?? Edited April 22, 2009 by shay "If the facts don't fit the theory, change the facts." Albert Einstein
weaponx Posted April 22, 2009 Posted April 22, 2009 What do you want to change the filenames to? Need more info.
lordicast Posted April 22, 2009 Posted April 22, 2009 (edited) I used this once ... its ugly but works #include <File.au3> Dim $File = @ScriptDir & '\find.txt' Dim $Where $Dir = InputBox('Original File Place','Where are the files to move?','C:\log\') $NewLocation = InputBox('New Location','Where would you like to store new files?','C:\NewLocation\New\') $uExt = InputBox('The Extenstion','What is the extenstion for the files we are moving?','txt') $loc = '*.'&$uExt RunWait(@ComSpec & ' /c ' & 'dir "' & $Dir &$loc& '" /a :h /b /s' & ' > "' & @ScriptDir & '\find.txt"', '', @SW_HIDE) _FileReadToArray($File, $where) For $x = 1 to $where[0] if StringInStr($where[$x],'.'&$uExt,0) = 0 Then sleep(100) Else $Ext = StringRight($where[$x],4) $In = StringInStr($where[$x],'\',0,-1) $Len = StringLen($where[$x]) $Out = $len - $in $Name = StringMid($where[$x],$In+1,$Out-4) $Final = $NewLocation & $name&$x&$Ext FileCopy($where[$x], $Final, 9) EndIf Next FileDelete(@ScriptDir & '\find.txt') MsgBox(0,'','Complete') Updated. to add valuaters addition Edited April 22, 2009 by lordicast [Cheeky]Comment[/Cheeky]
Valuater Posted April 22, 2009 Posted April 22, 2009 Might want to just "list" the files with the extention he is after $loc = '*.***' should be placed after... $uExt = InputBox('The Extenstion','What is the extenstion for the files we are moving?','txt') and do this.... $loc = '*.' & $uExt 8)
lordicast Posted April 22, 2009 Posted April 22, 2009 lol thanks I didnt even catch that headache saver! @Val [Cheeky]Comment[/Cheeky]
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