SHELL: copy perticular date created files into other directory

1step :

ls -l | grep 'Nov  3' | awk '{ print $9}' >> /dest/file.txt

------------------------------------------------------------------------------------------------------------  |
|    note: $9 is for what                                                                              |
|                                                                                                             |
|    ex: -rw-r--r-- 1  root root 112962 Nov   17:23 welcome1.213086216.log   |
|            $1      $2 $3   $4    $5       $6   $7  $8          $9                              |
|                                                                                                             |
|    now $9 copy only file name (welcome1.213086216.log) into file.txt          |
|                                                                                                             |
--------------------------------------------------------------------------------------------------------------
2nd step

write script -> vi myscript.sh

#!/bin/sh
list=` cat /dest/file.txt`
for i in $list; do
echo $i
cp $i /dest
done
exit


3rd step:

#sh myscript.sh

now all files on given date stored in /Dest folder

Comments

Popular posts from this blog