× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Albert York wrote:
I'm sorry if I am giving confusing information. It stems from my
ignorance. The file type is '*TYPE1' or '*TYPE2'

*TYPE1 and *TYPE2 are internal things used by IBM to keep track of the physical means that was used to store the file on disk, and really doesn't matter to what you're doing.



I tried your suggestion below and it comes back with:

find: 001-0018 Error found running command attr/filename.typ No such
path or directory

Hmmm... is it possible that you typed the command wrong? It should look like this:

find /path/to/myfolder -exec attr {} PC_READ_ONLY=0 \;

It sounds to me like you put "attr{}" which is missing a space between 'attr' and '{}'.

Let's take a step back... First of all, I don't know what the actual problem is. Is it that the read-only attribute is set? Or is it that you only have read permission to the file?

I suggested the command (above) as a possible solution to the read-only attribute being set. Normally, in QShell, if you want to remove the read-only attribute from a file, you'd type this:

attr /path/to/myfile.txt PC_READ_ONLY=0

That would find the file (myfile.txt) and it would un-set the read-only attribute. The problem with that solution is that it only unsets the attribute of a single file -- and you'd manually have to go through and type every single filename, which isn't good.

Fortunately, there's the 'find' utility. 'find' lets you run ANY command you want, and it'll repeat the command for all of the files that match a given pattern. So this is what I told it:

find /path/to -exec <SOMECOMMAND>

This means to find all of the files in the /path/to directory, or any subdirectories with it. For each file it finds, it'll run <SOMECOMMAND>. When it runs <SOMECOMMAND> it has the option to insert the filename into the command string. If it finds open & close braces next to each other, i.e. the {} characters, it will insert the filename there. So -exec attr {} PC_READ_ONLY=0 tells it to run

attr /path/to/file1.typ PC_READ_ONLY=0
attr /pato/to/file2.typ PC_READ_ONLY=0
etc...

It runs it for every single file in any directory or subdirectory of /path/to, saving you having to manually run the 'attr' command over and over. Find knows nothing about the command it's running, it just inserts the filename wherever the {} characters are. You can use it to run your own RPG programs if you really want it to... For example:

find /path/to -exec /QSYS.LIB/QGPL.LIB/MYPGM.PGM {} \;

This would call a program named MYPGM in QGPL over and over again, and pass the filename as a parameter.

The \; characters denote the end of the command string.

So anyway, I was doing this:

find /path/to -exec attr {} PC_READ_ONLY=0 \;

But it's important not to omit the space between attr and {}, because then it'll do this:

attr/path/to/file1.txt
attr/path/to/file2.txt

Missing that space will dramatically change the meaning of the command, because now it's looking for a command named 'file1.txt' thats in the relative path of attr/path/to which is wrong. 'attr' isn't supposed to be part of the directory name, it's supposed to be the command. So you NEED that space there.

Anyway... I have no idea if this will solve your problem or not, but if the problem is the PC_READ_ONLY attribute, it should shut it off.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.