F
freesoft12
I have a file containing many paths (files/links/dirs) and to remove
duplicate or redundant paths. I want to open the file and read each
path in that file and create a directory tree from it. Next, I want to
copy that directory tree extracted from the file and move it
underneath another directory (preserve the hierarchy).
For example, my file contains the following paths:
/a/b/c
/a/b
/a/b/d
In the first path, 'c' is a regular file. The second path can be
ignored since it is already covered by the first path. In the third
path, 'd' is a symbolic link that points to (say) ../e/f (a regular
file).
I want to move this directory tree underneath another directory, say /
tmp. Hence I will have /tmp/a/b/c, /tmp/a/b/d -> /tmp/a/e/f.
Can you suggest an efficient data structure to capture the directory
tree information?
Regards
Joe
duplicate or redundant paths. I want to open the file and read each
path in that file and create a directory tree from it. Next, I want to
copy that directory tree extracted from the file and move it
underneath another directory (preserve the hierarchy).
For example, my file contains the following paths:
/a/b/c
/a/b
/a/b/d
In the first path, 'c' is a regular file. The second path can be
ignored since it is already covered by the first path. In the third
path, 'd' is a symbolic link that points to (say) ../e/f (a regular
file).
I want to move this directory tree underneath another directory, say /
tmp. Hence I will have /tmp/a/b/c, /tmp/a/b/d -> /tmp/a/e/f.
Can you suggest an efficient data structure to capture the directory
tree information?
Regards
Joe