Hi,
you can wrap those three lines in a little script. Eg
Code:
#!/bin/bash
set -e
f=$1
d=$(dirname $(readlink -f $f))
ts=$(stat -c %y $d)
\rm $f
touch --date="$ts" -m $d
couple of things to note:
- This script is UNTESTED. Use at own risk (any script containing commands like rm should be treated with suspicion)
- The "set -e" will cause the script to exit on any error.
- \rm is used instead of rm in an attempt to protect against aliases for rm.
- The readlink call is used to get the full path to the file, so that you will get the full path to the directory... careful when using symbolic links.
If you are not familiar with any of the commands used in this script, please carefully read their man pages.
Anyway, HTH,
Evo2.