ignoring directory structure with Tar
Hi,
I am writing a program which needs 'tar' The problem is that 'tar' preserves directory structure, but I dont want it to. I need to create a simple archive with all files inside it. No directory structure. E.g Code:
$ pwd Code:
--dir3--|--dir1 -- file1 Code:
--dir3 --- file1 file2 Do you know the exact options? I've search the manual, without any luck Thank you |
If what you want is not in the tar manual, then maybe tar won't do this...
You may need to have some lines in your script to move the files into one directory before tarring. In pseudo-code, I'm guessing something like this: ls -R to list all files, regardless of subdirectory loop thru all of these, deleting the directories, and using "mv" to put them in a new directory |
Check out a program called "star". It is tar-compatible, but it has a zillion options. One of them is to create tar files without directory structure (-d).
Since the intention of this option to be compatible with "tar versions which do not deal with directories", your archive might contain a flat structure, but still be compatible with tar. You'd have to check it out yourself. jlinkels |
All times are GMT -5. The time now is 01:13 PM. |