Skip to main content

Thread: ubuntu linux copy all files from folder with extension including subfolders in a cron


hello,

i've been working cronjobs , im looking automatically backup files in www/domain/, there lot of files not needed take lot of space, images , such.

lets want copy files root folder (and subfolders) extensions .php , .inc, possible??

want every hour, , folder date added it...

cron this??

date= `date -i`;
5 * * * * cp /home/tobias/www/sb/ /home/tobias/www/backup/sb$date/

mean know simple line work, needs added guess. need filter .php , .inc files, keep filestructure, if these files in subfolders need created or copied too....

add , or change of course?

thank in advance!

not tested, following script,or minor variant of can desired job.

code:
#!/bin/bash    datei=$(date -i)  cd /home/tobias/www/sb  tar -c -f - $(find . -name '*.inc' -o -name '*.php') | \    tar -c /home/tobias/www/backup/sb${datei} -x -f -


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] ubuntu linux copy all files from folder with extension including subfolders in a cron


Ubuntu

Comments