Sign in to follow this  
Followers 0
addictedtofunk

An "Array" of Problems....

7 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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

:lmao:

Edit: inserted the critical space after @COMSPEC

Edited by trids

Share this post


Link to post
Share on other sites

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 file

returns the number of items in your array, just remember to subtract 1 from the result.

The result, should be the last item containing your filename

HTH

HardCopy


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

Share this post


Link to post
Share on other sites

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

:lmao:

Nice trick.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by jinxter

> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

The backslashes are in my original post, above :lmao: .. but i was showing a way of fishing, rather than providing the fish itself.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0