@All...thanks for your respond...
Here is information about my environment.
[fedora@netmanripper ~]# cat /etc/issue
CentOS release 4.6 (Final)
Kernel \r on an \m
[fedora@netmanripper ~]# echo $SHELL
/bin/bash
@wpeckham...I just have a few Perl background...
or maybe you can show me the example
@methyl
thanks a lot.
Till now, i've never use stat command...
---------- Post updated at 03:14 AM ---------- Previous update was at 02:29 AM ----------
Til now here is my progress, I tried in another PC,
[sunardo@userdocs latihan]$ ls -ltr
total 40
-rw-rw-r-- 1 sunardo sunardo 158 Feb 16 2010 hello.pl
-rw-rw-r-- 1 sunardo sunardo 106 Feb 16 2010 while.pl
-rw-rw-r-- 1 sunardo sunardo 123 Feb 17 2010 getpwen.pl
-rw-rw-r-- 1 sunardo sunardo 196 Feb 17 2010 cekperm.pl
-rw-rw-r-- 1 sunardo sunardo 226 Feb 18 2010 pss.pl
-rw-rw-r-- 1 sunardo sunardo 385 Mar 1 2010 ceksisop.pl
drwxrwxr-x 5 sunardo sunardo 4096 Mar 11 2010 latpython
-rw-rw-r-- 1 sunardo sunardo 4806 Mar 12 2010 save_cf_updtartis_reg_done.jsp
drwxrwxr-x 2 sunardo sunardo 4096 Sep 25 14:01 script
...........................................................................
So, firstly generate the directory based on files timestamp
[sunardo@userdocs latihan]$ find -type f -name '*pl' -printf "mkdir /opt/projects/backup/%TY%Tm%Td\n" | sort | uniq
mkdir /opt/projects/backup/20100216
mkdir /opt/projects/backup/20100217
mkdir /opt/projects/backup/20100218
mkdir /opt/projects/backup/20100301
and dump(redirect) it's output to a file and make it executeable.
[sunardo@userdocs latihan]$ find -type f -name '*pl' -printf "mkdir /opt/projects/backup/%TY%Tm%Td\n" | sort | uniq > move.sh
[sunardo@userdocs latihan]$ chmod +x move.sh
Another simpler way is pipe it to another shell instance
[sunardo@userdocs latihan]$ find -type f -name '*pl' -printf "mkdir /opt/projects/backup/%TY%Tm%Td\n" | sh
The second, move the file into the directory created before
[sunardo@userdocs latihan]$ find -type f -name '*pl' -printf "mv %h/%f /opt/projects/backup/%TY%Tm%Td/%f\n"
mv ./while.pl /opt/projects/backup/20100216/while.pl
mv ./getpwen.pl /opt/projects/backup/20100217/getpwen.pl
mv ./hello.pl /opt/projects/backup/20100216/hello.pl
mv ./ceksisop.pl /opt/projects/backup/20100301/ceksisop.pl
mv ./cekperm.pl /opt/projects/backup/20100217/cekperm.pl
mv ./pss.pl /opt/projects/backup/20100218/pss.pl
[sunardo@userdocs latihan]$ find -type f -name '*pl' -printf "mv %h/%f /opt/projects/backup/%TY%Tm%Td/%f\n" | sh
Plis, CMIIW with my script.
Is there another simplest way?