addictedtofunk Posted October 19, 2006 Posted October 19, 2006 I need to copy the largest file in a directory to another directory. I have copied each file name to an array. The file i copy will ALWAYS be the last number/entry in the array so what i need to do is copy the file that corresponds the the last entry in the array. So i need to say max number in array = file, then copy file.
trids Posted October 19, 2006 Posted October 19, 2006 (edited) I would read the first line in "c:\topmost.lst", generated by the following..RunWait( @COMSPEC & " /c dir c:\folder\*.txt /b/o-s>c:\topmost.lst", "", @SW_HIDE )HTH Edit: inserted the critical space after @COMSPEC Edited October 20, 2006 by trids
HardCopy Posted October 19, 2006 Posted October 19, 2006 I need to copy the largest file in a directory to another directory. I have copied each file name to an array. The file i copy will ALWAYS be the last number/entry in the array so what i need to do is copy the file that corresponds the the last entry in the array. So i need to say max number in array = file, then copy file.Look up Ubound command in the help filereturns the number of items in your array, just remember to subtract 1 from the result.The result, should be the last item containing your filenameHTHHardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad
Blue_Drache Posted October 19, 2006 Posted October 19, 2006 I would read the first line in "c:\topmost.lst", generated by the following..RunWait( @COMSPEC & "/c dir c:older*.txt /b/o-s>c: opmost.lst", "", @SW_HIDE ) HTH Nice trick. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
addictedtofunk Posted October 20, 2006 Author Posted October 20, 2006 AutoIt RunWait( @COMSPEC & "/c dir c: older*.txt /b/o-s>c: opmost.lst", "", @SW_HIDE ) Didnt seem to work...Unable to execute External program System cannot find path specified
jinxter Posted October 20, 2006 Posted October 20, 2006 (edited) RunWait(@ComSpec & " /c dir c:older*.txt /b /o-s>c:opmost.lst","", @SW_HIDE) I suppose you are changing to the dir before you run the program, otherwise it might be wise to add the path aswell. Edited October 20, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't.
trids Posted October 20, 2006 Posted October 20, 2006 The backslashes are in my original post, above .. but i was showing a way of fishing, rather than providing the fish itself.
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