Beranda > Linux, Tutorial > Find, Copy or Delete file/folder on linux console

Find, Copy or Delete file/folder on linux console


Jika ingin mencari file berekstensi *.mp3 di subdirektory /home/share kemudian menghapus tanpa ada konfirmasi :

find /home/share/* -type f -name "*.mp3" -exec rm -f {} \;

jika ingin mencari file  berekstensi *.mp3 di  subdirektokry /home/share kemudian ingin menyalin ke direktory “mymusic”   :

find /home/share/* -type f -name "*.mp3" -exec cp {} /home/user/mymusic \;

Jika ingin mencari file ‘TA201112.*  tetapi hanya file yang terupdate kurang dari 3 hari saja kemudian mengabaikan file extensi *.EXE  terus  dicopy ke directory lain :

find /folder/source/*  -type  f  -name  ‘TA201112.*’  -mtime -3  ! -name ‘*.EXE’  -exec  cp  {} /folder/dest  \;

jika ingin copy  file “TA201112”  tetapi hanya file yg terupdate saja yg akan di copy dan mengabaikan konfirmasi penghapusan y/n :

yes | cp -auv /folder/source/TA201112.*?   /folder/dest/

Perintah find,copy dan delete diatas jika ingin dijalankan secara rutinitas bisa dibuat kedalam “bash script” dan dijadwalkan menggunakan “crontab”.

—- >  melakukan copy,backup,mirroring  file/folder  menggunakan perintah  “rsync”  akan  lebih  baik.

Iklan
Kategori:Linux, Tutorial
  1. Mei 25, 2012 pukul 8:48 am

    Do you mind if I quote a couple of your articles as long as I provide credit
    and sources back to your weblog? My website is in the very same niche as yours and my visitors
    would really benefit from a lot of the information you provide here.
    Please let me know if this alright with you. Cheers!

  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: