Help with copy files from multiple directories one inside other of the same type to one directory

Alexander Skwar listen at alexander.skwar.name
Sat Jul 29 17:59:31 UTC 2006


· Todd Slater <dontodd at gmail.com>:

> On 7/29/06, Alexander Skwar <listen at alexander.skwar.name> wrote:
>> · Todd Slater <dontodd at gmail.com>:
>>
>> > for deb in `find /top/level/directory -type f -iname '*.deb'`
>>
>> *EXTREMELY* bad. What do you do, when there are file- and/or directory
>> names with spaces?
> 
> I understand that, but I've never met a .deb with a space in the name,

Me neither, but you don't know, how the directories are named. Well - 
I don't know, at least.

> which is why I gave this example. I figured it might be easier for
> somebody obviously new to CLI.

Well, in this case, hints should be given, which will work in
many more cases. "for f in `find`" doesn't work, if the file
or directory names contain spaces and also special characters (eg.
line break, tab, ...).

Hence I gave the hint to do

        find | while ...

Alexander Skwar
-- 
Ich habe das Problem, daß ich zuviel weiß.
                -- Prof. Informationssysteme, FH Schweinfurt






More information about the ubuntu-users mailing list