PDA

View Full Version : File change



GVader
29th July, 2011, 05:29 PM
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
20th August, 2011, 08:19 PM
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