how to change drwxrwxr-x to -rwxrwxr-x (change the first left flag) lazarus / 32-Linux ---------------------------------------------------------------------- creatxr · 2019-04-07 14:07 how to change drwxrwxr-x to -rwxrwxr-x (change the first left flag) change flag to d , - , or l to treat directory as file or to mark back as directory thanks. ---------------------------------------------------------------------- Thaddy · 2019-04-07 15:15 man chmod ---------------------------------------------------------------------- lucamar · 2019-04-07 16:01 Quote from: Thaddy on April 07, 2019, 05:15:33 pmman chmod You can not change the directory flag with chmod, only the permission bits.* @creatxr: Let me make a little search in my info sources; I remember having seen something related some time or other but I don't remember whether it can be done or not--although I think it can. * In case there is any doubt: Quote from: man chmod[... discussion of UGO-RWXS options omitted ...] A numeric mode is from one to four octal digits (0-7), derived by adding up  bits  with  values 4, 2, and 1.  Omitted digits are assumed to be leading zeros.The first digit selects the set user ID (4) and set group ID (2), and  restricted deletion or sticky (1) attributes.The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1);The third  selects permissions  for  other users in the file's group, with the same values; andthe fourth for other users not in the file's group, with the same values.[...etc...] (Re-formated by myself) ---------------------------------------------------------------------- marcov · 2019-04-07 16:07 Note that you can afaik open directories as files using normal FPC I/O. ---------------------------------------------------------------------- lucamar · 2019-04-07 19:24 I don't know if the URL still works but I found a "note to myself" about this: Quote from: superuser.comlinux - How to remove directory flag? - Super User https://superuser.com/questions/855212/how-to-remove-directory-flag Changing the inode type would give you a corrupt filesystem, nothing else. (You would do that with filesystem debugging tools, which are filesystem specific and pretty dangerous - backup what you can before attempting anything like that. Example for the Linux ext filesystems: debugfs.)