2

I am not sure if it is possible.

I do ls -l, it gives all the files in the current directory. Is there a way to say list only files that weren't created/modified on Saturday's with shell command?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

3 Answers3

1

A way to do this :

$ LANG=C find . -maxdepth 1 -printf '%p %AA\n' |
    awk '$NF=="Saturday"{next}{$NF=""}1'

I assume we don't print files for all Saturdays. This is or not what you expect.

Gilles Quénot
  • 31,569
  • 7
  • 64
  • 82
1

Simpler:

find . -maxdepth 1 -printf '%Ta\t%p\n' | grep -v -i '^sat'

ref: This answer.

Ketan Maheshwari
  • 9,054
  • 6
  • 40
  • 53
1

You should select which time you need

  • %y modification
  • %w creation
  • %z change

or any combination:

stat * --printf="%n\t%y %z\n" | grep -vF $(date -d "last Saturday" +%F) | cut -f1

Also choice what infomation you need and compose --printf= line.

Or you can use just find command

find -maxdepth 1 -type f -daystart \
     ! -mtime $[$(date +%d)-$(date -d "last Saturday" +%d)]
Costas
  • 14,806
  • 20
  • 36