petro2
asked on
moving files one at a time by oldest time to youngest time
I would like to move all the files in a directory, one at a time in 20 second internals with the files with the oldest date/time 1st and continue until finished. I know I can do the whole directory by
mv `ls /DIR/FILE*` /DIR2/
thanks
mv `ls /DIR/FILE*` /DIR2/
thanks
I guess we will see a few more universal suggestions soon.
======
Werner
======
Werner
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have places an cp ( copy command ) instead mv ( move )
for you to test.
Regards
for you to test.
Regards
ASKER
Does exactly what I need and exits correctly. thansk jq
In ksh I would do something like this:
ls -tr | while read -r line
do
if [ -f $line ] ; then
<your move>
sleep 20
fi
done
The if ... just makes sure that it is a file and not a directory ...
======
Werner