# OT: file attribute serialization in Windows

**URL:** <https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381>\
**Category:** Ruby\
**Created:** [October 12, 2010, 2:28pm UTC](https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381 "2010-10-12T14:28:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [October 12, 2010, 2:28pm UTC](https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381/1 "2010-10-12T14:28:00Z")

</div>

I am writing a backup program (not necessarily in Ruby) and I need to  
back up ALL of a file’s attributes.

For Windows:

R Read-only files  
H Hidden files  
A Files ready for archiving  
S System files

I Not content indexed files  
L Reparse Points

1. Long and short names
2. Owners
3. Alternate data streams (ugh)

Does anyone Out There know of code that will pick up all (did I miss  
any?) of these attributes?

Is there Ruby code that serialize and deserialize all of the attributes?

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [October 12, 2010, 3:28pm UTC](https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381/2 "2010-10-12T15:28:17Z")

</div>

On Tue, Oct 12, 2010 at 2:27 PM, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Is there Ruby code that serialize and deserialize all of the attributes?

Hm, maybe you can use xcacls command line utility to help with that.  
You’ll find it somewhere on MS’s download pages. (But do not confuse  
it with a VB program with the same / similar name.) HTH

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [October 12, 2010, 4:49pm UTC](https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381/3 "2010-10-12T16:49:42Z")

</div>

On Oct 12, 6:27am, Ralph S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> L Reparse Points
> 
> 1. Long and short names
> 2. Owners
> 3. Alternate data streams (ugh)
> 
> Does anyone Out There know of code that will pick up all (did I miss any?) of  
> these attributes?
> 
> Is there Ruby code that serialize and deserialize all of the attributes?

Take a look at win32-file and win32-file-stat. I’m not sure what an  
“alternate data stream” is, though.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![ralphshnelvar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@ralphshnelvar](https://www.ruby-forum.com/u/ralphshnelvar)\
**Post date:** [October 12, 2010, 5:06pm UTC](https://www.ruby-forum.com/t/ot-file-attribute-serialization-in-windows/196381/4 "2010-10-12T17:06:38Z")

</div>

On 10/12/2010 9:44 AM, Daniel B. wrote:

> > S System files  
> > Is there Ruby code that serialize and deserialize all of the attributes?
> 
> Take a look at win32-file and win32-file-stat. I’m not sure what an  
> “alternate data stream” is, though.

The “alternate data streams” are basically filesystem “forks”:

> **[Fork (file system)](https://en.wikipedia.org/wiki/Fork_%28filesystem%29)**
>
> In a computer file system, a fork is a set of data associated with a file-system object. File systems without forks only allow a single set of data for the contents, while file systems with forks allow multiple such contents. Every non-empty file must have at least one fork, often of default type, and depending on the file system, a file may have one or more other associated forks, which in turn may contain primary data integral to the file, or just metadata. 
> Unlike extended attributes, a simil...

> **[File Streams (Local File Systems) - Win32 apps](https://learn.microsoft.com/en-us/windows/win32/fileio/file-streams?redirectedfrom=MSDN)**
>
> In the NTFS file system, streams contain the data that is written to a file, and that gives more information about a file than attributes and properties.

-Jeremy
