PDA

View Full Version : Easily copy all .deb files in folder & subfolder via cli?



mips
October 14th, 2011, 10:58 AM
Hi,

I need to copy all *.deb files found in /media/Ubuntu 11.10 amd64/pool/main to /var/cache/apt.

Problem is they are spread across a gazillion sub folders inside 'main'.

Is there an easy way to do this via cli? Can someone provide me with the commandline syntax please?

Why? I'm doing a custom install of 11.10 starting with a base (cli only) install and then I want to build on that but I have limited bandwidth so would prefer to copy all the deb files from the cd into the apt cache so any files that are local will install faster and save me some bandwidth.

nerdopolis
October 14th, 2011, 11:12 AM
I think its


find -path "/media/Ubuntu 11.10 amd64/pool/main" -name "*.deb" | while read FILE
do
cp "$FILE" "/var/cache/apt"
done

mips
October 14th, 2011, 11:21 AM
Thanks, tried that but it did nothing.

matt_symes
October 14th, 2011, 11:24 AM
Hi


sudo bash -c "find /media/Ubuntu\ 11.10\ amd64/pool/main -name *.deb -exec cp {} /var/cache/apt \;"Here is a 1 liner.

Kind regards

ice60
October 14th, 2011, 11:25 AM
find "/media/Ubuntu 11.10 amd64/pool/main" -type f -name '*.deb' -exec cp -i {} "/var/cache/apt" \;

i think that is correct. maybe wait for someone to say it's correct first though because i'm not sure!

mips
October 14th, 2011, 11:33 AM
Hi


sudo bash -c "find /media/Ubuntu\ 11.10\ amd64/pool/main -name *.deb -exec cp {} /var/cache/apt \;"Here is a 1 liner.

Kind regards

Thanks a million, works brilliantly!



find "/media/Ubuntu 11.10 amd64/pool/main" -type f -name '*.deb' -exec cp -i {} "/var/cache/apt" \;

i think that is correct. maybe wait for someone to say it's correct first though because i'm not sure!

Thanks, looks the same as the above.

Martin Marshalek
October 14th, 2011, 11:53 AM
EDIT: Sorry, just re-read your post.

mips
May 2nd, 2012, 05:28 PM
Thanks again, this info just saved my bacon one more time ;)

blithen
May 3rd, 2012, 12:57 AM
The thread has been solved but had to chime me 2 cents in.
This is why I LOVELOVELOVELOVELOVE the terminal...so powerful.

mips
September 6th, 2012, 01:57 PM
And I came back looking for it again :biggrin:

graabein
September 6th, 2012, 08:10 PM
The terminal is where you execute little programs that are all created to solve some small task, and they're constructed to take input stream and create output stream, while printing info to the screen, usually. So you just string em together and whoopdedo.