Copy Files And Subfolders


Recommended Posts

I have a music collection which I want to back up. All of my mp3s are in a music folder, with subfolders of albums/artists/etc. I'd like a command that will copy only the mp3s (i.e. don't copy album art or anything like that) and preserve the subfolder structure.

Thanks,

Matt

Link to post
Share on other sites

Bit of a roundabout way:

 $ cp -lr $COLLECTION $COPY
$ find $COPY -type f ! -iname '*.mp3' -delete
$ mv $COPY $DESTINATION

$COPY is a scratch directory on the same partition as the collection, $DESTINATION is the final destination. You can remove the -delete option and add -depth before -type in the find to see what files will deleted.

Alternatively, if you don't mind the extra copying, you can just cp -r to the destination and run the above find there.

Edited by jcl
Link to post
Share on other sites

at work we have contest to see who can make a script smaller. the ideal is to take a working multi line script or set of commands and make it as small as possible

here is a one liner for the mp3 move

find $SOURCEFOLDER -name "*.mp3" -exec cp {} $DESTINATION \;

if you are at the root of your home folder put a . for the source folder to get all mp3 files no matter where in home they may be.

Link to post
Share on other sites

Doesn't work:

 ~/tmp/m :)
$ mkdir foo foo/bar
~/tmp/m :)
$ touch foo/bar/a.mp3 foo/bar/b.mp3
~/tmp/m :)
$ find foo
foo
foo/bar
foo/bar/a.mp3
foo/bar/b.mp3
~/tmp/m :)
$ find foo/ -name "*.mp3" -exec cp {} foo.bak \;
~/tmp/m :)
$ ls -l
total 4
drwx------ 3 jcl jcl 4096 2008-05-01 22:21 foo
-rw------- 1 jcl jcl 0 2008-05-01 22:21 foo.bak
~/tmp/m :)
$ rm foo.bak
~/tmp/m :)
$ mkdir foo.bak
~/tmp/m :)
$ find foo/ -name "*.mp3" -exec cp {} foo.bak \;
~/tmp/m :)
$ find foo.bak/
foo.bak/
foo.bak/a.mp3
foo.bak/b.mp3

If the target isn't a directory, it's overwritten by each file in turn; if it is a directory, it's left with a flattened copy of the source tree (tree structure isn't preserved).

Edited by jcl
Link to post
Share on other sites

---EDIT--

Sorry missread.. you are right.. I did not keep the structure and I missed that whole part

this will keep the structure and place the files in a nice tgz for backup and restore

find /home/huskeyw -name "*.gif" -print0 | xargs -0t tar --no-recursion -PSczf /tmp/find/gif.tgz

you could untar it right after to get the same output, but its not one command

find /home/huskeyw -name "*.gif" -print0 | xargs -0t tar --no-recursion -PSczf /tmp/find/gif.tgz;cd /tmp/find/;tar zxvf gif.tgz

hope this helps someone.

I left the original post so you can see what I was thinking.. also to point out.. that I feel like a dum A$$ after rereading you response..

it works for me, but I put to copy to a folder not a file

huskeyw@ubuntu-laptop:/tmp$ ls
gconfd-huskeyw orbit-huskeyw seahorse-aoi2Cl Tracker-huskeyw.5990
keyring-cYDBha pulse-huskeyw tmp.jZvSSS5741 virtual-huskeyw.uBgb8E

note noting in tmp so we create a folder to put my gif files

huskeyw@ubuntu-laptop:/tmp$ mkdir find

now lets capture a list of all gif files I have in my home folder

find /home/huskeyw/ -name "*.gif" -printf %f\\n
find: /home/huskeyw/.ssh: Permission denied
arrow.gif
arrowd.gif
broken-image.gif
grabber.gif
gopher-audio.gif
gopher-binary.gif
gopher-find.gif
gopher-image.gif
gopher-menu.gif
gopher-movie.gif
gopher-sound.gif
gopher-telnet.gif
gopher-text.gif
gopher-unknown.gif
loading-image.gif
table-add-column-after-active.gif
table-add-column-after-hover.gif
table-add-column-after.gif
table-add-column-before-active.gif
table-add-column-before-hover.gif
table-add-column-before.gif
table-add-row-after-active.gif
table-add-row-after-hover.gif
table-add-row-after.gif
table-add-row-before-active.gif
table-add-row-before-hover.gif
table-add-row-before.gif
table-remove-column-active.gif
table-remove-column-hover.gif
table-remove-column.gif
table-remove-row-active.gif
table-remove-row-hover.gif
table-remove-row.gif
Blank Bkgrd.gif
Btzhsepa.gif
Citrus Punch Bkgrd.gif
Ivy.gif
Network Blitz Bkgrd.gif
Sweets Bkgrd.gif
aleabanr.gif
amaizrul.gif
anabnr2.gif
aswrule.gif
citbannA.gif
fieruled.gif
sunbannA.gif
tech.gif
Blank Bkgrd.gif
Btzhsepa.gif
Citrus Punch Bkgrd.gif
Ivy.gif
Network Blitz Bkgrd.gif
Sweets Bkgrd.gif
aleabanr.gif
amaizrul.gif
anabnr2.gif
aswrule.gif
citbannA.gif
fieruled.gif
sunbannA.gif
tech.gif
0000000001_000000000000000017246[1].gif
0000000001_000000000000000151527[1].gif
0408_004_A_728090_A_NTC_415[1].gif
6CDE404B4BFEC334D023E5422081E0[1].gif
Generic_Missions_Site_Banners_MSCOM_180x150[1].gif
addrbook[1].gif
clear1x1[1].gif
collapse[1].gif
copyto[1].gif
deleted[1].gif
exclaim[1].gif
expandbutton-open[1].gif
icon-contact-dl[1].gif
icon-folder-tasks[1].gif
icon-journal[1].gif
icon-msg-forward[1].gif
icon-msg-signed-reply[1].gif
icon-msg-unread[1].gif
icon_ieaddons[1].gif
icon_support[1].gif
imp-high[1].gif
light[1].gif
lightbtm[1].gif
login-arrow[1].gif
loginHeader[1].gif
loginh1[1].gif
logoff[1].gif
logon_IE_top[1].gif
main-bg-trans[1].gif
msnbf[1].gif
nb-hide-ql[1].gif
nb-ql-tgl[1].gif
newemail[1].gif
newitem[1].gif
notes[1].gif
osb[1].gif
outbox[1].gif
pg-next[1].gif
pipe[1].gif
por2_active_cap_lft[1].gif
por_active_cap_lft[1].gif
por_arrow[1].gif
portlet-gray-right[1].gif
portlet-left[1].gif
public-fld[1].gif
refresh[1].gif
saic_link[1].gif
saic_link[2].gif
signin[1].gif
sort-d[1].gif
spacer[1].gif
tab_on_a[1].gif
titlebar-button-minimize[1].gif
titlebar-gray[1].gif
video[1].gif
32[1].gif
5-1x1_tracking_pixel[1].gif
9CC7E6CB6C74EE6769A6C8FDA33AB[1].gif
KenD_CEO[1].gif
bg_b[1].gif
calendar-lg[1].gif
dark[1].gif
down-w[1].gif
dumpster[1].gif
folder-icon[1].gif
folder-lg[1].gif
glow_b[1].gif
icon-appt[1].gif
icon-folder-calendar[1].gif
icon-folder[1].gif
icon-msg-reply[1].gif
icon-msg-signed-read[1].gif
icon_ie7[1].gif
ie7_home_feature_bullet[1].gif
inbox[1].gif
issaic_header[1].gif
issaic_logo[1].gif
junkemail[1].gif
light[1].gif
log-off[1].gif
logo_microsoft[1].gif
logon_IE_bot[1].gif
logon_Microsoft[1].gif
moveto[1].gif
options[1].gif
pg-first[1].gif
por_active_bkg_span[1].gif
por_bkg_cap_lft[1].gif
prev-bott[1].gif
primedns[1].gif
resize-dot[1].gif
search-box-issaic[1].gif
search-box-people[1].gif
search[1].gif
sent-items[1].gif
show-hub-playerbg[1].gif
t[1].gif
t[2].gif
tab_on_b[1].gif
task-lg[1].gif
titlebar-right[1].gif
view-document[1].gif
view-flag[1].gif
32E46DE281A68B9C33FC582D2569D[1].gif
7CE57843948D6DF13E79A2DE4E15C[1].gif
86F1396496DFE1BAD68AB5F28409[1].gif
WL_b[1].gif
bg[1].gif
blank[1].gif
blank[2].gif
btn_232x24[1].gif
bullet[1].gif
dark[1].gif
down-b[1].gif
drafts[1].gif
edit-portlet-icon[1].gif
email[1].gif
flg-empty[1].gif
icon-doc[1].gif
icon-folder-journal[1].gif
icon-msg-read[1].gif
icon-msg-signed-forward[1].gif
icon-msg-signed[1].gif
icon-mtgreq[1].gif
icon-post[1].gif
jeffkoons[1].gif
lightbtm[1].gif
logon_logo[1].gif
main-bg[1].gif
main-bg[2].gif
msft[1].gif
msn_b[1].gif
msx80019_main_180x150_ms[1].gif
nb-bkgd[1].gif
nb-show-ql[1].gif
options-lg[1].gif
pg-last[1].gif
plus[1].gif
por2_active_cap_rt[1].gif
por_active_cap_rt[1].gif
por_bkg_cap_rt[1].gif
portlet-gray-left[1].gif
portlet-right[1].gif
prev-off[1].gif
prev-right[1].gif
replyall[1].gif
rules[1].gif
search[1].gif
sr[1].gif
titlebar-gray-right[1].gif
titlebar[1].gif
tool-bkgd[1].gif
view-importance[1].gif
windowsNGN_ltr[1].gif
0000000033_000000000000000578669[2].gif
26[1].gif
IT_portlet_logo[1].gif
arrow_green_rt[1].gif
btn_232x24_a[1].gif
buttons[1].gif
clear[1].gif
contacts-lg[1].gif
cwtv_nav[1].gif
delete[1].gif
help[1].gif
icon-contact[1].gif
icon-folder-contacts[1].gif
icon-folder-notes[1].gif
icon-paperclip[1].gif
icon-task[1].gif
icon_community[1].gif
icon_quickref[1].gif
issaic_footer[1].gif
logo2[1].gif
logo_windows[1].gif
logo_windowslive[1].gif
minus[1].gif
newfldr[1].gif
nin-bg[1].gif
pg-prev[1].gif
playerbg[1].gif
por2_active_bkg_span[1].gif
por_bkg[1].gif
por_bkg_divline[1].gif
register[1].gif
reminder[1].gif
root[1].gif
rules-lg[1].gif
saic_link[1].gif
saic_logo_footer[1].gif
saic_tnail[1].gif
saicatglance[1].gif
search-box-capabilities[1].gif
search-box-google[1].gif
status-info[1].gif
tab_IE_off[1].gif
timeline-slider[1].gif
view-paperclip[1].gif
Yukon PM Schedule.gif
Yukon SE Schedule.gif
Yukon SI Schedule.gif
Yukon Schedule.gif
071207_ST_Q4_C_300x250[1].gif
234x60e[1].gif
CAI7OB9M.gif
CAOPQRAB.gif
ainw_000000[1].gif
b_homepage[1].gif
bh[1].gif
bh[2].gif
bins=1[1].gif
blank[1].gif
btn_232x24[1].gif
bullets[1].gif
clear1x1[1].gif
down-b[1].gif
drafts[1].gif
email[1].gif
flg-empty[1].gif
folder-icon[1].gif
hit[1].gif
ico_cpu[1].gif
icon-doc[1].gif
icon-msg-signed-forward[1].gif
icon-msg-signed[1].gif
icon-msg-unread[1].gif
icon-mtgreq[1].gif
icon-post[1].gif
imgad[1].gif
imp[1].gif
junkemail[1].gif
justify-r[1].gif
logo_windowslive[1].gif
logon_IE_top[1].gif
media224440[1].gif
nav-bg-over[1].gif
nb-bkgd[1].gif
nok[1].gif
options-lg[1].gif
pair_networks_20[1].gif
pg-last[1].gif
pg-prev[1].gif
pixel_white[1].gif
playnowcars[1].gif
plus[1].gif
por_active_cap_rt[1].gif
por_bkg_cap_rt[1].gif
prev-off[1].gif
prev-right[1].gif
prio-low[1].gif
refresh[1].gif
rules[1].gif
saicatglance[1].gif
search-box-issaic[1].gif
search-box-people[1].gif
sharegamesbanner[1].gif
spelling[1].gif
sr[1].gif
tab_on_b[1].gif
tabby[1].gif
thumb-shadow[1].gif
tit_gamesbyothers[1].gif
tit_partnersites[1].gif
tit_randomgames[1].gif
tit_siteinfo[1].gif
tit_topgames_blue[1].gif
titlebar-gray-right[1].gif
titlebar-right[1].gif
tool-font[1].gif
tool-spellprogress[1].gif
top-story-bg-hover[1].gif
tt[1].gif
video_link[1].gif
view-importance[1].gif
view-webpage[1].gif
469554974[1].gif
CA4TMZWD.gif
CACPQ3KT.gif
CAGBZNIG.gif
IT_portlet_logo[1].gif
RGST[1].gif
arrow_yellow[1].gif
arrowred[1].gif
attach[1].gif
b_topgames[1].gif
back[1].gif
blank[1].gif
btn_232x24_a[1].gif
bullet_arrow_orange[1].gif
bullnumb[1].gif
calendar-lg[1].gif
chotz[1].gif
click[1].gif
down-w[1].gif
header-background[1].gif
headline-arrow[1].gif
hr_gray[1].gif
ico_hdd[1].gif
icon-appt[1].gif
icon-folder[1].gif
icon-msg-read[1].gif
icon-msg-signed-read[1].gif
icon_community[1].gif
icon_quickref[1].gif
inbox[1].gif
issaic_header[1].gif
issaic_logo[1].gif
justify-l[1].gif
lat_r[1].gif
logon_logo[1].gif
moveto[1].gif
next[1].gif
nin-bg[1].gif
notes[1].gif
options[1].gif
pgph-ltr[1].gif
por2_active_cap_lft[1].gif
por_active_cap_lft[1].gif
por_bkg[1].gif
por_bkg_divline[1].gif
prev-bott[1].gif
resize-dot[1].gif
rss[1].gif
saic_link[1].gif
saic_link[2].gif
save[1].gif
search[1].gif
sent-items[1].gif
status-info[1].gif
tab_on_a[1].gif
task-lg[1].gif
tit_exclusivegames_blue[1].gif
toms-hardware-logo[1].gif
tool-bkgd[1].gif
top-story-bg-hover[1].gif
view-document[1].gif
view-flag[1].gif
293042060[1].gif
CA6P8RSB.gif
CATO6D93.gif
CAU7WLY5.gif
KenD_CEO[1].gif
Surfrider300x250_1[1].gif
b_freesite[1].gif
banner609x65b[1].gif
bluaro[1].gif
borders[1].gif
bullet_arrow[1].gif
cap-right[1].gif
checkname[1].gif
checkout_000000[1].gif
clear[1].gif
connect[1].gif
contacts-lg[1].gif
copyto[1].gif
delete[1].gif
dumpster[1].gif
edit-portlet-icon[1].gif
expandbutton-open[1].gif
fontcolor[1].gif
help[1].gif
hit[1].gif
ico_vga[1].gif
icon-contact[1].gif
icon-msg-reply[1].gif
icon-paperclip[1].gif
icon-task[1].gif
imgad[1].gif
issaic_footer[1].gif
lat_l[1].gif
left[1].gif
logo2[1].gif
logo[1].gif
logo_windows[1].gif
logon_IE_bot[1].gif
minus[1].gif
msx80019_ware_180x150_ms_001[1].gif
nav-bg[1].gif
nb-show-ql[1].gif
newfldr[1].gif
newitem[1].gif
outdent[1].gif
pgph-rtl[1].gif
pixel[2].gif
por2_active_bkg_span[1].gif
por_active_bkg_span[1].gif
por_arrow[1].gif
portlet-gray-left[1].gif
portlet-left[1].gif
prev[1].gif
print[1].gif
reminder[1].gif
right[1].gif
root[1].gif
rules-lg[1].gif
saic_logo_footer[1].gif
search-box-capabilities[1].gif
search[1].gif
tit_gamesearch_green[1].gif
tit_newgames[1].gif
top_ten_bar[1].gif
view-paperclip[1].gif
11[1].gif
12009424321195222546-freegamepick-1-1[1].gif
CA97VX0K.gif
CAI70ZFS.gif
CAOVALIH.gif
CAU7GJNC.gif
addrbook[1].gif
b_contact[1].gif
b_home[1].gif
b_submit_green[1].gif
bh[1].gif
bomg[1].gif
cap-left[1].gif
collapse[1].gif
connect[1].gif
deleted[1].gif
folder-lg[1].gif
hr_wil_tnail[1].gif
icon-contact-dl[1].gif
icon-journal[1].gif
icon-msg-forward[1].gif
icon-msg-signed-reply[1].gif
icon_ie7[1].gif
icon_support[1].gif
imp-high[1].gif
indent[1].gif
justify-c[1].gif
loginHeader[1].gif
loginh1[1].gif
logo_microsoft[1].gif
logoff[1].gif
logon_Microsoft[1].gif
nb-hide-ql[1].gif
nb-ql-tgl[1].gif
nb-sel-bkgd[1].gif
newemail[1].gif
outbox[1].gif
pg-first[1].gif
pg-next[1].gif
pixel_transp[1].gif
por2_active_cap_rt[1].gif
por_bkg_cap_lft[1].gif
portlet-gray-right[1].gif
portlet-right[1].gif
prio-high[1].gif
public-fld[1].gif
replyall[1].gif
saic_link[1].gif
search-box-google[1].gif
search-button[1].gif
send[1].gif
sig[1].gif
sort-d[1].gif
spacer[1].gif
status-info20[1].gif
tab_IE_off[1].gif
tit_gamecategories[1].gif
tit_top10games[1].gif
titlebar-button-minimize[1].gif
titlebar-gray[1].gif
titlebar[1].gif
top-story-bg[1].gif
top-story-bg[2].gif
windowsNGN_ltr[1].gif
x-click-but21[1].gif
jitalert.gif
tips.gif
jitalert.gif
tips.gif
no_favicon.gif
rss.gif
16x16-digg-guy.gif
blinklist.gif
facebook.gif
furl.gif
netscape.gif
technorati.gif
tumblr.gif
arrow.gif
arrowd.gif
broken-image.gif
grabber.gif
gopher-audio.gif
gopher-binary.gif
gopher-find.gif
gopher-image.gif
gopher-menu.gif
gopher-movie.gif
gopher-sound.gif
gopher-telnet.gif
gopher-text.gif
gopher-unknown.gif
loading-image.gif
table-add-column-after-active.gif
table-add-column-after-hover.gif
table-add-column-after.gif
table-add-column-before-active.gif
table-add-column-before-hover.gif
table-add-column-before.gif
table-add-row-after-active.gif
table-add-row-after-hover.gif
table-add-row-after.gif
table-add-row-before-active.gif
table-add-row-before-hover.gif
table-add-row-before.gif
table-remove-column-active.gif
table-remove-column-hover.gif
table-remove-column.gif
table-remove-row-active.gif
table-remove-row-hover.gif
table-remove-row.gif
EasternSierraPanorama.gif
b.gif
gbck.gif
hb.gif
logo.gif
mainbck.gif
splash.gif
topbck.gif
arrow.gif
arrowd.gif
broken-image.gif
grabber.gif
gopher-audio.gif
gopher-binary.gif
gopher-find.gif
gopher-image.gif
gopher-menu.gif
gopher-movie.gif
gopher-sound.gif
gopher-telnet.gif
gopher-text.gif
gopher-unknown.gif
loading-image.gif
table-add-column-after-active.gif
table-add-column-after-hover.gif
table-add-column-after.gif
table-add-column-before-active.gif
table-add-column-before-hover.gif
table-add-column-before.gif
table-add-row-after-active.gif
table-add-row-after-hover.gif
table-add-row-after.gif
table-add-row-before-active.gif
table-add-row-before-hover.gif
table-add-row-before.gif
table-remove-column-active.gif
table-remove-column-hover.gif
table-remove-column.gif
table-remove-row-active.gif
table-remove-row-hover.gif
table-remove-row.gif
splash.gif
STAR.gif
STARlogo.gif
EasternSierraPanorama-1.gif
EasternSierraPanorama-2.gif
splash.gif

sorry I have lots of gif files, but its a mass example :)

now lets copy the gif files to a tmp folder

huskeyw@ubuntu-laptop:/tmp$ find /home/huskeyw/  -name "*.gif" -exec cp {} /tmp/find/ \;
find: /home/huskeyw/.ssh: Permission denied

now lets look at what we got

huskeyw@ubuntu-laptop:/tmp$ cd /tmp/find/
huskeyw@ubuntu-laptop:/tmp/find$ ls
0000000001_000000000000000017246[1].gif
0000000001_000000000000000151527[1].gif
0000000033_000000000000000578669[2].gif
0408_004_A_728090_A_NTC_415[1].gif
071207_ST_Q4_C_300x250[1].gif
11[1].gif
12009424321195222546-freegamepick-1-1[1].gif
16x16-digg-guy.gif
234x60e[1].gif
26[1].gif
293042060[1].gif
32[1].gif
32E46DE281A68B9C33FC582D2569D[1].gif
469554974[1].gif
5-1x1_tracking_pixel[1].gif
6CDE404B4BFEC334D023E5422081E0[1].gif
7CE57843948D6DF13E79A2DE4E15C[1].gif
86F1396496DFE1BAD68AB5F28409[1].gif
9CC7E6CB6C74EE6769A6C8FDA33AB[1].gif
addrbook[1].gif
ainw_000000[1].gif
aleabanr.gif
amaizrul.gif
anabnr2.gif
arrowd.gif
arrow.gif
arrow_green_rt[1].gif
arrowred[1].gif
arrow_yellow[1].gif
aswrule.gif
attach[1].gif
back[1].gif
banner609x65b[1].gif
b_contact[1].gif
b_freesite[1].gif
bg[1].gif
bg_b[1].gif
b.gif
bh[1].gif
bh[2].gif
b_home[1].gif
b_homepage[1].gif
bins=1[1].gif
blank[1].gif
blank[2].gif
Blank Bkgrd.gif
blinklist.gif
bluaro[1].gif
bomg[1].gif
borders[1].gif
broken-image.gif
b_submit_green[1].gif
btn_232x24[1].gif
btn_232x24_a[1].gif
b_topgames[1].gif
Btzhsepa.gif
bullet[1].gif
bullet_arrow[1].gif
bullet_arrow_orange[1].gif
bullets[1].gif
bullnumb[1].gif
buttons[1].gif
CA4TMZWD.gif
CA6P8RSB.gif
CA97VX0K.gif
CACPQ3KT.gif
CAGBZNIG.gif
CAI70ZFS.gif
CAI7OB9M.gif
calendar-lg[1].gif
CAOPQRAB.gif
CAOVALIH.gif
cap-left[1].gif
cap-right[1].gif
CATO6D93.gif
CAU7GJNC.gif
CAU7WLY5.gif
checkname[1].gif
checkout_000000[1].gif
chotz[1].gif
citbannA.gif
Citrus Punch Bkgrd.gif
clear[1].gif
clear1x1[1].gif
click[1].gif
collapse[1].gif
connect[1].gif
contacts-lg[1].gif
copyto[1].gif
cwtv_nav[1].gif
dark[1].gif
delete[1].gif
deleted[1].gif
down-b[1].gif
down-w[1].gif
drafts[1].gif
dumpster[1].gif
EasternSierraPanorama-1.gif
EasternSierraPanorama-2.gif
EasternSierraPanorama.gif
edit-portlet-icon[1].gif
email[1].gif
exclaim[1].gif
expandbutton-open[1].gif
facebook.gif
fieruled.gif
flg-empty[1].gif
folder-icon[1].gif
folder-lg[1].gif
fontcolor[1].gif
furl.gif
gbck.gif
Generic_Missions_Site_Banners_MSCOM_180x150[1].gif
glow_b[1].gif
gopher-audio.gif
gopher-binary.gif
gopher-find.gif
gopher-image.gif
gopher-menu.gif
gopher-movie.gif
gopher-sound.gif
gopher-telnet.gif
gopher-text.gif
gopher-unknown.gif
grabber.gif
hb.gif
header-background[1].gif
headline-arrow[1].gif
help[1].gif
hit[1].gif
hr_gray[1].gif
hr_wil_tnail[1].gif
ico_cpu[1].gif
ico_hdd[1].gif
icon-appt[1].gif
icon_community[1].gif
icon-contact[1].gif
icon-contact-dl[1].gif
icon-doc[1].gif
icon-folder[1].gif
icon-folder-calendar[1].gif
icon-folder-contacts[1].gif
icon-folder-journal[1].gif
icon-folder-notes[1].gif
icon-folder-tasks[1].gif
icon_ie7[1].gif
icon_ieaddons[1].gif
icon-journal[1].gif
icon-msg-forward[1].gif
icon-msg-read[1].gif
icon-msg-reply[1].gif
icon-msg-signed[1].gif
icon-msg-signed-forward[1].gif
icon-msg-signed-read[1].gif
icon-msg-signed-reply[1].gif
icon-msg-unread[1].gif
icon-mtgreq[1].gif
icon-paperclip[1].gif
icon-post[1].gif
icon_quickref[1].gif
icon_support[1].gif
icon-task[1].gif
ico_vga[1].gif
ie7_home_feature_bullet[1].gif
imgad[1].gif
imp[1].gif
imp-high[1].gif
inbox[1].gif
indent[1].gif
issaic_footer[1].gif
issaic_header[1].gif
issaic_logo[1].gif
IT_portlet_logo[1].gif
Ivy.gif
jeffkoons[1].gif
jitalert.gif
junkemail[1].gif
justify-c[1].gif
justify-l[1].gif
justify-r[1].gif
KenD_CEO[1].gif
lat_l[1].gif
lat_r[1].gif
left[1].gif
light[1].gif
lightbtm[1].gif
loading-image.gif
login-arrow[1].gif
loginh1[1].gif
loginHeader[1].gif
logo[1].gif
logo2[1].gif
log-off[1].gif
logoff[1].gif
logo.gif
logo_microsoft[1].gif
logon_IE_bot[1].gif
logon_IE_top[1].gif
logon_logo[1].gif
logon_Microsoft[1].gif
logo_windows[1].gif
logo_windowslive[1].gif
mainbck.gif
main-bg[1].gif
main-bg[2].gif
main-bg-trans[1].gif
media224440[1].gif
minus[1].gif
moveto[1].gif
msft[1].gif
msn_b[1].gif
msnbf[1].gif
msx80019_main_180x150_ms[1].gif
msx80019_ware_180x150_ms_001[1].gif
nav-bg[1].gif
nav-bg-over[1].gif
nb-bkgd[1].gif
nb-hide-ql[1].gif
nb-ql-tgl[1].gif
nb-sel-bkgd[1].gif
nb-show-ql[1].gif
netscape.gif
Network Blitz Bkgrd.gif
newemail[1].gif
newfldr[1].gif
newitem[1].gif
next[1].gif
nin-bg[1].gif
no_favicon.gif
nok[1].gif
notes[1].gif
options[1].gif
options-lg[1].gif
osb[1].gif
outbox[1].gif
outdent[1].gif
pair_networks_20[1].gif
pg-first[1].gif
pg-last[1].gif
pg-next[1].gif
pgph-ltr[1].gif
pgph-rtl[1].gif
pg-prev[1].gif
pipe[1].gif
pixel[2].gif
pixel_transp[1].gif
pixel_white[1].gif
playerbg[1].gif
playnowcars[1].gif
plus[1].gif
por2_active_bkg_span[1].gif
por2_active_cap_lft[1].gif
por2_active_cap_rt[1].gif
por_active_bkg_span[1].gif
por_active_cap_lft[1].gif
por_active_cap_rt[1].gif
por_arrow[1].gif
por_bkg[1].gif
por_bkg_cap_lft[1].gif
por_bkg_cap_rt[1].gif
por_bkg_divline[1].gif
portlet-gray-left[1].gif
portlet-gray-right[1].gif
portlet-left[1].gif
portlet-right[1].gif
prev[1].gif
prev-bott[1].gif
prev-off[1].gif
prev-right[1].gif
primedns[1].gif
print[1].gif
prio-high[1].gif
prio-low[1].gif
public-fld[1].gif
refresh[1].gif
register[1].gif
reminder[1].gif
replyall[1].gif
resize-dot[1].gif
RGST[1].gif
right[1].gif
root[1].gif
rss[1].gif
rss.gif
rules[1].gif
rules-lg[1].gif
saicatglance[1].gif
saic_link[1].gif
saic_link[2].gif
saic_logo_footer[1].gif
saic_tnail[1].gif
save[1].gif
search[1].gif
search-box-capabilities[1].gif
search-box-google[1].gif
search-box-issaic[1].gif
search-box-people[1].gif
search-button[1].gif
send[1].gif
sent-items[1].gif
sharegamesbanner[1].gif
show-hub-playerbg[1].gif
sig[1].gif
signin[1].gif
sort-d[1].gif
spacer[1].gif
spelling[1].gif
splash.gif
sr[1].gif
STAR.gif
STARlogo.gif
status-info[1].gif
status-info20[1].gif
sunbannA.gif
Surfrider300x250_1[1].gif
Sweets Bkgrd.gif
t[1].gif
t[2].gif
tabby[1].gif
tab_IE_off[1].gif
table-add-column-after-active.gif
table-add-column-after.gif
table-add-column-after-hover.gif
table-add-column-before-active.gif
table-add-column-before.gif
table-add-column-before-hover.gif
table-add-row-after-active.gif
table-add-row-after.gif
table-add-row-after-hover.gif
table-add-row-before-active.gif
table-add-row-before.gif
table-add-row-before-hover.gif
table-remove-column-active.gif
table-remove-column.gif
table-remove-column-hover.gif
table-remove-row-active.gif
table-remove-row.gif
table-remove-row-hover.gif
tab_on_a[1].gif
tab_on_b[1].gif
task-lg[1].gif
tech.gif
technorati.gif
thumb-shadow[1].gif
timeline-slider[1].gif
tips.gif
tit_exclusivegames_blue[1].gif
tit_gamecategories[1].gif
tit_gamesbyothers[1].gif
tit_gamesearch_green[1].gif
titlebar[1].gif
titlebar-button-minimize[1].gif
titlebar-gray[1].gif
titlebar-gray-right[1].gif
titlebar-right[1].gif
tit_newgames[1].gif
tit_partnersites[1].gif
tit_randomgames[1].gif
tit_siteinfo[1].gif
tit_top10games[1].gif
tit_topgames_blue[1].gif
toms-hardware-logo[1].gif
tool-bkgd[1].gif
tool-font[1].gif
tool-spellprogress[1].gif
topbck.gif
top-story-bg[1].gif
top-story-bg[2].gif
top-story-bg-hover[1].gif
top_ten_bar[1].gif
tt[1].gif
tumblr.gif
video[1].gif
video_link[1].gif
view-document[1].gif
view-flag[1].gif
view-importance[1].gif
view-paperclip[1].gif
view-webpage[1].gif
windowsNGN_ltr[1].gif
WL_b[1].gif
x-click-but21[1].gif
Yukon PM Schedule.gif
Yukon Schedule.gif
Yukon SE Schedule.gif
Yukon SI Schedule.gif
huskeyw@ubuntu-laptop:/tmp/find$

so I don't know what does not work, to copy all files from one place to another.. it does not keep diretory structure because we are not worring about that or else we would have to keep them

note that duplactes are not coped..

also once you ran this command you can use the --update for the copy command to only update the backup folder

find /home/huskeyw/ -name "*.gif" -exec cp --update {} /tmp/find/ \;

also we could be more useful and tar up the results

huskeyw@ubuntu-laptop:/tmp/find$ ls
huskeyw@ubuntu-laptop:/tmp/find$
huskeyw@ubuntu-laptop:/tmp/find$ find /home/huskeyw -name "*.gif" -print0 | xargs -0t tar --no-recursion -PSczf /tmp/find/gif.tgz
huskeyw@ubuntu-laptop:/tmp/find$ ls
gif.tgz

I skipped all the output from the find/ you will find this did keep all my directroy structue so it can be restored

afer doing a tar zxvf on gif.tgz

I get

huskeyw@ubuntu-laptop:/tmp/find$ ls

gif.tgz home

and my whole structure is there..

Edited by iccaros
Link to post
Share on other sites

Oh, hey, tar.

 $ tar -c $SOURCE | tar -x --wildcards '*.mp3'

Add other options as needed. Bonus: you can backup over a network by piping through netcat.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...