File change

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GVader
    Newbie
    • Jul 2011
    • 1

    #1

    File change

    I am looking to swap out about 30 images in some folders on a RedHat linux box. The same dozen images appear in a LARGE number of folders (bad planning, i know, but i am inheriting this mess). Does anyone know of a way to swap out complete files quickly (by large number of folders, i am talking thousands)
  • GastonJ
    V.I.P. Member
    • Dec 2009
    • 5505

    #2
    Try looking up use of the 'find' command, it's flexible and allows interaction, such as

    find / -name "myfile.txt" -exec rm -f {} ";"

    will recurse all subdirectories of the root '/' directory and delete all instances of myfile.txt

    Depends what you want to do. What you have described so far isn't very descriptive. However if I wanted to copy a new file of the same name into all subdirectories of the one I was in I'd use:

    find ./ -name "myfile.jpg" -exec cp /home/gastonj/myfile.jpg {} ";"

    However I have not tested it, so check it first if that's the sort of thing you're after..

    HTH
    Last edited by GastonJ; 20 August, 2011, 23:34.
    My master plan is to live forever..... going to plan so far
    Despite the cost of living, it's still very popular.
    No good deed goes unpunished....

    Comment

    Working...