Wollf Posted December 4, 2008 Share Posted December 4, 2008 Hello i want to make something that will search all files with certain ending but different names *.kwreplay at deskpot. then i want to make it take them from bigger to smaller and rename them with numbers 1.kwreplay, 2.kwreplay and at the end move them at a place. what command i need to use and learn for this one? Link to comment Share on other sites More sharing options...
FireFox Posted December 4, 2008 Share Posted December 4, 2008 Hello i want to make something that will search all files with certain ending but different names *.kwreplay at deskpot. then i want to make it take them from bigger to smaller and rename them with numbers 1.kwreplay, 2.kwreplay and at the end move them at a place. what command i need to use and learn for this one?Hi, Search in helpfile this functions : FileFindFirstFile() FileFindNextFile() FileGetSize() FileRename() @DesktopDir Link to comment Share on other sites More sharing options...
martin Posted December 4, 2008 Share Posted December 4, 2008 Hello i want to make something that will search all files with certain ending but different names *.kwreplay at deskpot. then i want to make it take them from bigger to smaller and rename them with numbers 1.kwreplay, 2.kwreplay and at the end move them at a place. what command i need to use and learn for this one?This is what I would probably do.Have a global variable $filelist.Use FileFindFirst and FileFindNext to find all the files which match *.kwreplay.Every time you find a file, get it's size with FileFindSize, and add the size and the name, in that order, to the variable $filelist and add '|' to separate different files.You will end up with all the files and the sizes in $filelist.Make an array of the files $aFiles = stringSplit($filelist,'|')then sort the array into order using _ArraySortNow you can go through the array and extract the file names and save them as required. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 4, 2008 Moderators Share Posted December 4, 2008 (edited) #include <array.au3> $a_array = _File_ListBySize(@DesktopDir, "*.kwreplay") _ArrayDisplay($a_array) Func _File_ListBySize($s_directory, $s_mask = "*", $f_greatest_to_least = True) $s_directory = StringRegExpReplace($s_directory, "[\\/]+\z", "") Local $s_files = "" Local $i_pid = Run(@ComSpec & ' /c dir /b /o:-s "' & $s_directory & "\" & $s_mask & '"', _ "", @SW_HIDE, 6) While Not @error $s_files &= StdoutRead($i_pid) WEnd If Not $s_files Then Return SetError(1, 0, 0) Local $a_split = StringSplit(StringStripCR(StringRegExpReplace($s_files, "[\r\n]+\z", "")), @LF) If $f_greatest_to_least Then Return $a_split Local $a_ret[$a_split[0] + 1] = [$a_split[0]], $i_add For $i = $a_split[0] To 1 Step - 1 $i_add += 1 $a_ret[$i_add] = $a_split[$i] Next Return $a_ret EndFunc Edited December 4, 2008 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