|
Rich, You might adapt the following to do a delete command. Jim --------------------
From the AS/400 FAQ at midrange.com
--------------------
How can I recursively change the owner of objects in the IFS?Q. I want
to change the owner for all the objects in the IFS and recurse
into each subdirectory and change the ownership there as well. What's
a good way to do that, since CHGOWN doesn't recurse?
A. This is easy to do in QSHELL. For example, to change everything in
directory called /some/dir to be owned by klemscot:
STRQSH
find /some/dir -exec chown klemscot {} \;
Or, maybe when one employee leaves and a new one starts you want to change
ownership from one person to another:
find . -user mike -exec chown klemscot {} \;
(the . means it will work out of the current directory)
In fact, you can have any QSHELL command be executed after the "-exec"
keyword. The {} is replaced with the name of the file when the command
is executed, and the \; tells the find command that it's reached the end
of the command string.
So, if you wanted to remove write access to everything in a directory,
you might do this:
find /some/dir -exec chmod -w {} \;
Or, of course, only take write access away from files who are owned by
mike:
find /some/dir -user mike -chmod -w {} \;
So, the find utility is great for working on directories recursively.
More info can be found in the information center:
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzahz/find.htm
Answer courtesy Scott Klement via Midrange-LYou can also submit this
to batch with a construct like this:
sbmjob job(printdir) cmd(QSH CMD('ls -al')) jobq(qs36evoke)David
Morris and Martin Rowe add the idea that one can use the SYSTEM
command instead of chown or chmod:
for autfil in $(find /dir/dir2 -name '*.extension');
do system "chgaut obj('"$autfil"') objaut(*all)";
done
Here is the command I used to change the owner, set the authority
list, and revoke public authority of all IFS files and directories in
a folder.
QSH CMD('for autfil in $(find /myfolder/*); do +
system "CHGOWN OBJ(''"$autfil"'') NEWOWN(MYNEWOWN)"; +
system "CHGAUT OBJ(''"$autfil"'') AUTL(MYAUTL)"; +
system "CHGAUT OBJ(''"$autfil"'') USER(*PUBLIC) +
DTAAUT(*AUTL) OBJAUT(*NONE)";
done')
Please note, the more files there are the longer it will take to run.
This update took about 4 hours to run on our 720 for about 25,000+
files and 700 directories. how about a simple
chown -R [owner USRPRF] [filespec]
eg
chown -R qsysopr /home/*
On 3/29/07, Rich Loeber <rich@xxxxxxxxx> wrote:
Is there any easy way to clear out files from the IFS when all you have available to you is the OS/400 command line? I'm cleaning off my old model 250 before decomissioning it and using the WRKLNK, DEL and RMVDIR commands is quite tedious. Am I missing something? Thanks. Rich Loeber Kisco Information Systems http://www.kisco.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.