Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- touch -r
- touch -r *(Dom[1]) .
- touch -r **/*(Dom[1]) .
- touch -r "$(find -mindepth 1 -maxdepth 1 -printf '%T+=%pn' |
- sort |tail -n 1 | cut -d= -f2-)" .
- touch -r "$(find -mindepth 1 -printf '%T+=%pn' |
- sort |tail -n 1 | cut -d= -f2-)" .
- mostrecent="`stat -c '%Y %n' * | sort -n | tail -n1 | cut -d ' ' -f '2-'`"
- mostrecent="`ls -t | head -n1`"
- touch -r "$mostrecent" *
- touch -r "`ls -t | head -n1`" *
- #!/bin/bash
- if [ -z "$1" ] ; then
- echo 'ERROR: Parameter missing. specify the folder!'
- exit
- fi
- #MODE=tail # change to newest file
- MODE=head # change to oldest file
- for d in "$1"/*/; do
- echo "running on $d"
- find "$d" -type d -execdir
- echo touch --reference="$(find "$d" -mindepth 1 -maxdepth 1 -printf '%T+=%pn'
- | sort | "$MODE" -n 1 | cut -d= -f2-)" "$d" ;
- # remove echo to really run it
- done
- mkdir /tmp/test
- cd /tmp/test
- mkdir d1
- mkdir d2
- touch d1/text1.txt
- sleep 1
- touch d1/movie1.mov
- touch d2/movie2.mov
- sleep 1
- touch d2/text2.txt
- touch notthis.file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement