Separate the apache user file and move or copy some were

Hi all,

I'm Using Centos 6.4

/opt/my_aplication/entry/data/0/

There are Thousands of files in this Directory, Only i need to copy or move the apache User's file from this to /tmp/backup , I have listed apache user's file using

find . -user apache -type f 

, its gave me the only apache user's files, How can i move it are copy the file to /tmp/backup , Will any one guide me ..

-rw-r--r-- 1 root   root    5.9K May 20  2013 0_zbdon0vx_0_ccueldeq_0.conv.log
-rwxrwxrwx 1 apache apache   24M May 20  2013 0_x92m4dn5_0_te65kj69_2.mp4
-rwxrwxrwx 1 root   root    171K May 20  2013 0_x92m4dn5_0_kfemau7m_2.jpg
-rwxrwxrwx 1 root   root    7.2M May 20  2013 0_x92m4dn5_0_4xwn4t6g_1.flv
-rw-r--r-- 1 root   root    7.4K May 20  2013 0_x92m4dn5_0_4xwn4t6g_0.conv.log
-rwxrwxrwx 1 root   root     15M May 20  2013 0_x92m4dn5_0_n1pqrefn_1.flv
-rw-r--r-- 1 root   root    7.6K May 20  2013 0_x92m4dn5_0_n1pqrefn_0.conv.log
-rwxrwxrwx 1 apache apache   24M May 20  2013 0_v0me8g8s_0_mw5psypq_2.mp4
-rwxrwxrwx 1 root   root     12M May 20  2013 0_x92m4dn5_0_cgvgijm1_1.mp4
-rw-r--r-- 1 root   root     11K May 20  2013 0_x92m4dn5_0_cgvgijm1_0.conv.log

You will extend the find command :

find . -type f -user apache -exec echo mv {} /tmp/backup/ \;

Remove echo if the result satisfies.
Change \; for \+ for performance if you need it.

Also, storing backups in /tmp is a bad idea since it is deleted after every reboot.

I would recommend making a new filesystem for backup.

1 Like

Yes its worked for me , Could you please give me little explanation what this will do ?

{} /tmp/backup/ \;

Can't understand what is {} will do and \;