maybe you should try and do it using something you're familiar with. in this case i would probably just use a simple shell script.
#!/bin/sh ls -t $1 | ( read keepthisone while read movethisone do echo $2 $movethisone $3 done )
very simple, serves multiple purposes.
$ ls -1 whacl-* whacl-20030601223002.gz whacl-20030602223002.gz whacl-20030603223003.gz whacl-20030604223003.gz whacl-20030605223003.gz $ ./movem.sh 'whacl-*' whacl-20030604223003.gz whacl-20030603223003.gz whacl-20030602223002.gz whacl-20030601223002.gz $ ./movem.sh 'whacl-*' cp /dev/null cp whacl-20030604223003.gz /dev/null cp whacl-20030603223003.gz /dev/null cp whacl-20030602223002.gz /dev/null cp whacl-20030601223002.gz /dev/null $ ./movem.sh 'whacl-*' mv /path/to/foreverstore mv whacl-20030604223003.gz /path/to/foreverstore mv whacl-20030603223003.gz /path/to/foreverstore mv whacl-20030602223002.gz /path/to/foreverstore mv whacl-20030601223002.gz /path/to/foreverstore $ ./movem.sh 'whacl-*' rm rm whacl-20030604223003.gz rm whacl-20030603223003.gz rm whacl-20030602223002.gz rm whacl-20030601223002.gz $ ./movem.sh 'whacl-*' rm | sh $ ls whacl-* whacl-20030605223003.gz
take out the 'echo' if you don't want to check your commands before doing them.
In reply to Re: Unix - Keep the last modified file in the directory and move/copy the rest of the files.
by zengargoyle
in thread Unix - Keep the last modified file in the directory and move/copy the rest of the files.
by hyliau
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |