Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    variable assignment find -name output csh

    Greetings fellow Linux users! I use Linux regularly, but I am still learning!

    I am trying to move a bunch of files that are in nested sub directories into one common folder. They all end in .dcm. To do this in the past I have done the following:

    foreach sub (subject1 subject2 . . .subjectn)

    pushd $sub
    mkdir common_folder
    set files = (`find ./ -name "*dcm"`)
    mv $files ./common_folder


    For some reason this is only working for a portion of the subjects. For the others, this is happening:

    set: No match

    But when I'm in that subject's directory and execute
    find ./ -name "*dcm" (no tilted quotes, var assignment, etc)
    I see a list of the files I want to move and their paths. So then I do this:
    set files = (`find ./ -name "*dcm"`)
    and I get
    set: No match.

    I have tried the following:

    set dcms = "*dcm"
    set files = (`find ./ -name "${dcms}"`)

    set files = (find ./ -name "${dcms}")

    set files = `find ./ -name "${dcms}"`

    set files = (`find ./ -name \*dcm`)

    set files = ( `find ./ -name "*dcm" -print` )

    set files = ( `find ./ -print -name "*dcm"` )

    set files = (`find ./ -print`)

    What, pray tell, am I missing?

  2. #2
    Figured it out. I actually wasn't doing anything wrong. The file structure, which I do not do by the way, had sub directories that contained "--" and "<>". When I tried to set it to a variable name, Linux didn't like it. But can any one tell me why Linux doesn't like "--" and "<>" in folder names? Much obliged!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts