How do I move the oldest or newest file in a directory to another with Mac OS X Terminal

后端 未结 4 572
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 06:19

I\'m trying to us the following command on Mac OSX 10.6 Terminal but it does not work..Any idea what I may be doing wrong?

These work...

List most recent

4条回答
  •  再見小時候
    2021-01-25 07:08

    Assuming the files you are moving are in the current directory:

    mv "`ls -1t | tail -1`" dir_to_move_to
    

    the quote help for spaces in filename, but I don't think my answer is elegant, any more elegant solution?

提交回复
热议问题