Hi Luis,
Don't be afraid to contradict me. As I mentioned before, I always use
the Unix-like tools in QShell, so I may certainly be missing a nuance of
RMVDIR.
Here's a quick test that I ran:
> STRQSH
$
> mkdir testrmv
$
> touch testrmv/myfile
$
> rmdir testrmv
rmdir: 001-2140 Error found removing the directory testrmv. Directory
not empty.
$
(Exit QShell... back to native env)
> RMVDIR DIR('/home/sklement/testrmv') SUBTREE(*ALL)
2 object links removed. 0 object links not removed.
As you can see... the RMVDIR command removed the directory as well as
the file inside it. I tried the same test with multiple subdirs, and
put files inside the subdirs, etc... all worked, with SUBTREE(*ALL) it
deletes everything inside the dir.
I tried the same test (the first one with a dir containing a single
empty file) , but this time I used RMVLNK instead:
> RMVDIR DIR('/home/sklement/testrmv') RMVLNK(*YES)
Directory contains objects. Directory is /home/sklement/testrmv.
So yeah, this did not work (just like you said, Luis) so I looked at the
help for it, and it says:
Note: The QDLS, QSYS.LIB and independent ASP QSYS.LIB file
systems support removal of links using this parameter
specification. For all other file systems, use the
SUBTREE(*ALL) parameter specification.
So, apparently, RMVLNK only works in QDLS or QSYS.LIB. That's a very
counter-intuitive (and stupid, IMHO) implementation. But, it does match
our findings. So I tried it again in the /QDLS filesystem
> RMVDIR DIR('/qdls/testrmv') RMVLNK(*YES)
Directory removed.
Works as expected, there.
Moral of the story: Just use the Unix commands. :-)
On 10/19/2012 7:43 AM, Luis Rodriguez wrote:
Scott,
I'm almost afraid to contradict you :-) but, if I remove the subdirectory,
copy a file to my '/home/test1' folder and try to run RMVLNK again, I get
the same error. What could be I doing wrong here?
On the other hand, I shouldn't be on V5R3 :-( (I use the QSH commands for
this, though).
Regards,
Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries
As an Amazon Associate we earn from qualifying purchases.