Quote:
Originally Posted by pintcat
Using LIST to create and append a list of files to the TAR command line is a good idea. I played around a little with different LIST options and it worked well for files and folders.
Now I'm trying to write a script which enables you to put a list of file and folder names (with or without place holders) and then calls TAR to archive all given files. Using LIST here in a script for file name dumping is a bit tricky, because if the given name is a folder and no place holder is used, it puts the whole content of the folder instead of the folder name itself. Example:
Assuming there is a folder called "DirName",
Code:
LIST QUICK NOHEAD DirName#?
...would simply put "DirName" as result. On the other hand...
Code:
LIST QUICK NOHEAD DirName
...would of course put DirName's content which, if appended to the TAR command line, would cause lots of "file not found" errors. I honestly doubt that there's a way to force LIST to put a folder's name rather than it's content.
|
You can surround the name with brackets to make it always be a wildcard.
LIST (DirName) will just print DirName if it exists, no matter if it is a file or a directory.
However, it will not fail if DirName does not exist. LIST DirName will return an error if it does not exist.
LIST (DirName#?) will work as before (list all entries which begin with DirName).