Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

This code touches files in alphabetical order.

I need to touch files in order it is in list_of_files, so first it touches file2, then file3, then file1).

Is there any other way to do this than to use repeat loop and do touch command as many times as there are items in list?

Thanks

set list_of_files to "'path/to/2' 'path/to/3' 'path/to/1'"
do shell script "touch " & list_of_files
share|improve this question
    
It might help if you expanded on this a bit. How are you sure that it's running through the files in an order other than your list? Running touch with three files should take so little time that they should all end up with the same timestamps (as OS X doesn't record file timestamps more granularly than seconds). –  robmathers Apr 22 '13 at 15:46
    
Why not write all the file names to a temporary file, change the do shell script command to be for $file in `cat /tmp/file.whatever`; do touch $ff ; done and delete the temporary file? –  bmike Apr 22 '13 at 17:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.