Shovel
Can't get enough of FH
- Joined
- Dec 22, 2003
- Messages
- 1,350
Hello all, more Windows scripting.
As users of Office will know, you can ste it to automagically create back up files of your documents with various additional file extensions: .wbk for Word backups for instance.
Basically, though I want the backup, I'm fed up of them appearing in my folders alongside the real thing. I'd like to know they're there for "if I need them".
Is there a way to set all files with the extension to be hidden, and better still to set all new files with that extension to be hidden as well?
I'm doubting that it is, which means that my alternative is to schedule a script to periodically scan my Documents directory for backup files and change their hidden attribute for me.
The "attrib" command should do the changing of the file permission, it's just a case of getting it to grab the appropraite files.
EDIT~ OK - done it. It's a useful little script though, so here it is to share:
+H adds the Hidden attribute.
/S checks all sub folders.
To get the full list of switches, type the usual:
One thing that I'm still interested in though and which isn't answered for me by just reading the attrib help text is how to get it to search for multiple file extensions in one go?
For instance, Excel backups and text file backups all have different extensions and I want to hide them as well, do I need to have a script repeatedly calling the above attrib command line or is there a regular expression-like syntax for entering multiple filenames all at once, and save searching the filesystem 5 or 6 times?
Thanks.
Ben
As users of Office will know, you can ste it to automagically create back up files of your documents with various additional file extensions: .wbk for Word backups for instance.
Basically, though I want the backup, I'm fed up of them appearing in my folders alongside the real thing. I'd like to know they're there for "if I need them".
Is there a way to set all files with the extension to be hidden, and better still to set all new files with that extension to be hidden as well?
I'm doubting that it is, which means that my alternative is to schedule a script to periodically scan my Documents directory for backup files and change their hidden attribute for me.
The "attrib" command should do the changing of the file permission, it's just a case of getting it to grab the appropraite files.
EDIT~ OK - done it. It's a useful little script though, so here it is to share:
Code:
attrib +H D:\bmpw\Documents\*.wbk /S
+H adds the Hidden attribute.
/S checks all sub folders.
To get the full list of switches, type the usual:
Code:
attrib /?
One thing that I'm still interested in though and which isn't answered for me by just reading the attrib help text is how to get it to search for multiple file extensions in one go?
For instance, Excel backups and text file backups all have different extensions and I want to hide them as well, do I need to have a script repeatedly calling the above attrib command line or is there a regular expression-like syntax for entering multiple filenames all at once, and save searching the filesystem 5 or 6 times?
Thanks.
Ben