View Single Post
  #8  
Old 01-05-2006, 02:35 AM
billious
 
Posts: n/a
Default Re: Select all files with particular attribute set ?


"MoiMeme" <vermeulenp@hotmail.com> wrote in message
news:uTYFciJEGHA.216@TK2MSFTNGP15.phx.gbl...
> "billious" <billious_1954@hotmail.com> a écrit dans le message de news:
> 43bac38f$0$10323$a82e2bb9@reader.athenanews.com...
>>
>> "MoiMeme" <vermeulenp@hotmail.com> wrote in message
>> news:OJe7jBJEGHA.2648@TK2MSFTNGP11.phx.gbl...
>>> Hi,
>>>
>>> happy new year all
>>>
>>> Simple question perhaps :
>>> - how can I select all files with a given attribute set ( for example
>>> all system files) within a folder and subfolders ?
>>>
>>> TIA !!
>>>

>>
>> Please describe exactly what you want to do.
>>
>> Are you looking for a list of files in a given subtree which have the
>> attribute(s) set or do you want some variety of graphical methodology?
>>
>> If you simply want a list, what are you going to do with the list? Simple
>> text list for a report, EXCEL (.CSV) list for some purpose, or are you
>> going to perhaps use the list to make an archive?
>>
>> More info - better help.
>>
>> HTH
>>
>> ...Bill
>>



>I want to be able to select all files with attributes read-only & system
>set, build a list of them and backup to an archive.
> The Windows search module doesn't allow tro select according to
> attribute(s) ( or at least I haven't been able to find how)
>


Here's a batch job that may help.

It's still not crystal clear whether you want (all files with attributes
(read-only & system set)) or (all files with attribute read-only) & (all
files with attribute system set)) but minor changes can easily be
accommodated.

[1]@echo off
[2]if exist arclist.txt del arclist.txt
[3]for /f "delims=" %%i in ('dir /b/a-d/s') do echo %%~ai %%~fi
[4]for /f "delims=" %%i in ('dir /b/a-d/s "d:\pathname\filemask.ext" ') do
echo %%~ai|findstr /r "r..s" >nul&if not errorlevel 1 echo %%~fi
>>arclist.txt


Each line begins [number]. Lines will be wrapped in transmission and need to
be rejoined. The [number] at the beginning of each line needs to be removed.


notes:
line [3] is redundant; it's there to show what is produced by the ~a
modifier facility to the FOR command. Note that it produces the string
"-rahs----" with any not-set attribute replaced by "-"

on line [4], the FINDSTR command is looking for "r..s" (r and s separated by
any 2 characters) if you want EITHER r or s set, then use "r s" in place of
"r..s"

arclist.txt will be built with the full filenames of the files to be
archived.

HTH

....Bill


Reply With Quote