Try  touch `ls -1`

On 15 Oct 2016, at 19:33, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:

> Yeah, that's what I thought at first, too. But touch begs to differ:
> 
> $ ls -1 | sort | touch
> usage:
> touch [-A [-][[hh]mm]SS] [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file 
> ...
> 
> -Carl
> 
> 
>> On Oct 15, 2016, at 7:31 PM, Macs R We <macs...@macsrwe.com> wrote:
>> 
>> Right off the bat, I think you made a mistake in putting the * at the end of 
>> the command. The whole idea of piping the output from LS is to input it to 
>> touch, and you just provided touch with another argument first. I think if 
>> you just let LS do its job and don't provide touch any arguments, you will 
>> get what you want, including all of the necessary requoting.
>> 
>>> On Oct 15, 2016, at 7:24 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>>> wrote:
>>> 
>>> I'm trying to arrange the files in a directory to have modification dates 
>>> according to alphabetical sort order. (Sounds weird, but Alpine car units 
>>> use modification date as the ordering of music tracks on a USB stick.)
>>> 
>>> In bash I'm using:
>>> 
>>> ls -1 | sort | touch *
>>> 
>>> ...but it doesn't work, there is no change in the modification date of the 
>>> files. I'm guessing the problem is that the filenames have spaces, so the 
>>> 'touch *' is only touching the first word of the filename.
>>> 
>>> Is there a way to do this?
>>> 
>>> -Carl
>>> 
>>> _______________________________________________
>>> MacOSX-talk mailing list
>>> MacOSX-talk@omnigroup.com
>>> http://www.omnigroup.com/mailman/listinfo/macosx-talk
>> 
> 
> _______________________________________________
> MacOSX-talk mailing list
> MacOSX-talk@omnigroup.com
> http://www.omnigroup.com/mailman/listinfo/macosx-talk


David P Henderson
c: 757.286.3212
--
"Human beings are unable to be honest with themselves about themselves. They 
cannot talk about themselves without embellishing."
    -- Akira Kurosawa

_______________________________________________
MacOSX-talk mailing list
MacOSX-talk@omnigroup.com
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to