Move files contained in a certain dir to the previous one (centOS)

Posted by Alex on Server Fault See other posts from Server Fault or by Alex
Published on 2012-12-10T15:13:39Z Indexed on 2012/12/10 17:06 UTC
Read the original article Hit count: 97

Filed under:

i will try to explain my problem (sorry for my bad english).

I have an image gallery with a directory structure like that:

images/dir1/subdir1/IMG/files.jpg
images/dir1/subdir2/IMG/files.jpg
images/dir1/subdir3/IMG/files.jpg
images/dir2/subdir1/IMG/files.jpg
.......
images/dir109/subdir1/IMG/files.jpg

the directory named images contains 109 dirs (dir1,dir2, ... dir109), the 109 dirs totally have 1200 subdirs inside, every subdir contain a dir named IMG with images into it (file1.jpg file2.jpg etc ...), i would like to move all the images contained into every dir named IMG into the previous dir (subdir) to have something like that:

images/dir1/subdir1/file1.jpg
images/dir1/subdir1/file2.jpg
images/dir1/subdir2/file1.jpg
........
images/dir109/subdir1/file.jpg

© Server Fault or respective owner

Related posts about centos