Jump to content

Recommended Posts

Posted

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.

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
Posted

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

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.

Posted

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

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
×
×
  • Create New...