8
3
I have a large number of small files, f, arranged in a directory structure like so:
/A/B/C/f
There are 11 directories at the level of A, each with about 100 directories at the level of B, each with about 30 directories at the level of C, each with one file f.
How do I move all files f up one level? For example, given this set of files...
/A/B/C/f1
/A/B/C/f2
/A/B/C/f3
/A/B/C/f4
I want the directory /A/B/
to contain 4 files, f1 through f4. Removing directories C is not necessary.
I'm hoping this is a solved problem, possibly involving find
, xargs
, and whatnot
. Any ideas?
Cheers,
James
This will obviously work for any one directory /A/B/C, but as I have about 30000 such directories, I am hoping for a command that can be executed at the top of the hierarchy to take care of them all at once. – jl6 – 2010-09-12T22:20:14.580
1@jl6 I see, and only files need moving? So C doesn't have to move to B, and B not to A, etc... – BloodPhilia – 2010-09-12T22:32:43.953
That's correct - the operation should only be performed on files, at the lowest level of the hierarchy, and they should only be moved one level up. – jl6 – 2010-09-12T23:00:54.107