Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing files by attribute 1

Status
Not open for further replies.

JPJeffery

Technical User
May 26, 2006
600
GB
Hi

This seems to be a VERY quiet forum, but let's see if this query gets any bites anyway.

Some background first:

There's a feature of DFS which prevent replication of files that have the temporary attribute set.

That's fine, but some of our files which aren't actually temp files have got this temporary attribute set, thus causing us an issue.

To fix this, this Microsoft article suggests running the following Powershell command:
Code:
Get-childitem D:\Data -recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}

Nice, BUT, I first want to list these files so I can make a decision for myself as to which ones are/are not temporary (since it's possible there will be "~roposal.doc" files, or *.tmp files).

As I'm very new to Powershell I'd like some help with editing this command so that instead of changing the attributes of the files it finds are 'temporary' it merely lists them.

So, help, please!

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, or photo, or breakfast...and so on)[/small]
 
Code:
Get-childitem D:\Data -recurse | ? {$_.attributes -band 0x100 -eq 0x100}

Should list them out, although I haven't tested that.

Do you have your Tek-Tips.com Swag? I've got mine!

Stop by the new Tek-Tips group at LinkedIn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top