How to recursively change modified date for folder and contents mac to current date

1

I'm currently using this script on a volume via folder action.

for f in "$@"
do
    touch "$f"
done

It changes the modified date for files and folders added to the volume to the current date with no problems, but, it will not change the modification date to the files within the folder.

What am I missing here?

sirlouie

Posted 2019-05-03T19:40:48.370

Reputation: 11

Answers

0

Your script doesn't recurse, so it's only covering the current directory level.

You can accomplish the same thing using these commands with pipe:

find . -print0 | xargs -0 touch

The find command will recurse through the current directory and all below it, then the output is passed into touch one at a time.

MMB

Posted 2019-05-03T19:40:48.370

Reputation: 506