Obtaining the Archive Attribute of a File on Windows Systems

DeLynn Berry:

Is it possible to check the archive attribute of Windows
files using Ruby? Or, even better, is it possible to get a
list of files that have active archive bits to then be able
to copy or move to a backup location?

You can do it using brute force:

require ‘find’

Find.find( ‘c:\temp’ ) do | aFile |
if attrib #{aFile} =~ /^A/
puts aFile
end
end

But it will (as far as I can see) not work on cygwin builds.

Regards,
M.

The command works in a Cygwin window.

Gavin

···

On Monday, March 31, 2003, 3:12:15 PM, Milan wrote:

DeLynn Berry:

Is it possible to check the archive attribute of Windows
files using Ruby? Or, even better, is it possible to get a
list of files that have active archive bits to then be able
to copy or move to a backup location?

You can do it using brute force:

require ‘find’

Find.find( ‘c:\temp’ ) do | aFile |
if attrib #{aFile} =~ /^A/
puts aFile
end
end

But it will (as far as I can see) not work on cygwin builds.

“Milan Maksimovic” maksa@sezampro.yu wrote in message news:005501c2f744$0f92f040$3bd8ecd8@tao

You can do it using brute force:

require ‘find’

Find.find( ‘c:\temp’ ) do | aFile |
if attrib #{aFile} =~ /^A/
puts aFile
end
end

But it will (as far as I can see) not work on cygwin builds.

Regards,
M.

Milan,

That works great. Thanks a ton!

DeLynn