ANy script for this?

Hi all,

I need to run the script on our file servers to get Last Acesses Date more 
than 180 
days.  It should search the sub-folders too.  
Windows 2003 server.

Thank you.
0
Utf
1/14/2010 7:27:02 PM
scripting.vbscript 564 articles. 0 followers. Follow

3 Replies
896 Views

Similar Articles

[PageSpeed] 37


"ed" <ed@discussions.microsoft.com> said this in news item 
news:4FF557C4-643F-4EB1-9738-AF22E0F1693E@microsoft.com...
> Hi all,
>
> I need to run the script on our file servers to get Last Acesses Date more
> than 180
> days.  It should search the sub-folders too.
> Windows 2003 server.
>
> Thank you.

Use the code you received in the Server group, leaving "active = no". 

0
Pegasus
1/14/2010 7:45:01 PM
Pegasus,

I really appreciate your help.

I use the script you wrote and change Active = no but I got the error "
C:\0\file2.vbs(1, 19) Microsoft VBScript compilation error: Expected literal 
con
stant" after I ran cscript file2.vbs.  What am I missing?

Const Active  = No
Const sSource = "c:\0"
Const MaxAge  = 15  'days
Const Recursive = True

Checked = 0
Deleted = 0

Set oFSO = CreateObject("Scripting.FileSystemObject")
if active then verb = "Deleting """ Else verb = "Old file: """
CheckFolder oFSO.GetFolder(sSource)

WScript.echo
if Active then
  verb = " file(s) deleted"
Else
  verb = " file(s) would be deleted"
end if
WScript.Echo Checked & " file(s) checked, " & Deleted & verb

Sub CheckFolder (oFldr)
  For Each oFile In oFldr.Files
    Checked = Checked + 1
    If DateDiff("D", oFile.DateLastAccessed, Now()) > MaxAge Then
      Deleted = Deleted + 1
      WScript.Echo verb & oFile.Path & """"
      If Active Then oFile.Delete
    End If
  Next

  if not Recursive then Exit Sub
  For Each oSubfolder In oFldr.Subfolders
    CheckFolder(oSubfolder)
  Next
End Sub


"Pegasus [MVP]" wrote:

> 
> 
> "ed" <ed@discussions.microsoft.com> said this in news item 
> news:4FF557C4-643F-4EB1-9738-AF22E0F1693E@microsoft.com...
> > Hi all,
> >
> > I need to run the script on our file servers to get Last Acesses Date more
> > than 180
> > days.  It should search the sub-folders too.
> > Windows 2003 server.
> >
> > Thank you.
> 
> Use the code you received in the Server group, leaving "active = no". 
> 
> .
> 
0
Utf
1/14/2010 8:37:01 PM
The code I posted used the words "True" and "False". These are fixed words 
and you cannot use words such as "Yes" or "No".

"ed" <ed@discussions.microsoft.com> said this in news item 
news:D24D0DB9-D278-40A9-9329-6164FD1EB589@microsoft.com...
> Pegasus,
>
> I really appreciate your help.
>
> I use the script you wrote and change Active = no but I got the error "
> C:\0\file2.vbs(1, 19) Microsoft VBScript compilation error: Expected 
> literal
> con
> stant" after I ran cscript file2.vbs.  What am I missing?
>
> Const Active  = No
> Const sSource = "c:\0"
> Const MaxAge  = 15  'days
> Const Recursive = True
>
> Checked = 0
> Deleted = 0
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> if active then verb = "Deleting """ Else verb = "Old file: """
> CheckFolder oFSO.GetFolder(sSource)
>
> WScript.echo
> if Active then
>  verb = " file(s) deleted"
> Else
>  verb = " file(s) would be deleted"
> end if
> WScript.Echo Checked & " file(s) checked, " & Deleted & verb
>
> Sub CheckFolder (oFldr)
>  For Each oFile In oFldr.Files
>    Checked = Checked + 1
>    If DateDiff("D", oFile.DateLastAccessed, Now()) > MaxAge Then
>      Deleted = Deleted + 1
>      WScript.Echo verb & oFile.Path & """"
>      If Active Then oFile.Delete
>    End If
>  Next
>
>  if not Recursive then Exit Sub
>  For Each oSubfolder In oFldr.Subfolders
>    CheckFolder(oSubfolder)
>  Next
> End Sub
>
>
> "Pegasus [MVP]" wrote:
>
>>
>>
>> "ed" <ed@discussions.microsoft.com> said this in news item
>> news:4FF557C4-643F-4EB1-9738-AF22E0F1693E@microsoft.com...
>> > Hi all,
>> >
>> > I need to run the script on our file servers to get Last Acesses Date 
>> > more
>> > than 180
>> > days.  It should search the sub-folders too.
>> > Windows 2003 server.
>> >
>> > Thank you.
>>
>> Use the code you received in the Server group, leaving "active = no".
>>
>> .
>> 
0
Pegasus
1/14/2010 8:43:07 PM
Reply:

Similar Artilces:

Reject script in pass through san script not working
I have a scenario that i had to check for dependencies of divisions(Human Resources) before their deletion and decide whether to let deletion proceed or not, i had done this for many entities like department(Dynamics) in my development dictionary, i registered a focus trigger before delete button of department form and checked dependencies for it on triggered script and allow or prevent deletion successfully. Now for division that is in the human resources dictionary i registered a cross-dictionary focus trigger to run before delete buttons change event as result = Trigger_RegisterFocus...

Sort Column Script
I need to have a script in Excel that would allow the sorting of columns from column "D" to the column before the last column with data. I do not want the last column sorted. The criteria for the sort is in row 1 (Name of an employee). Additional columns will be inserted between column "D" and the last column so they need to be sorted. I hope this is clear. Can someone please assist me? Thank you! Bernie Bernie How can someone named Bernie NOT know how to do this? ;-) Sub BernieSort() Range(Range(Range("D1"), Range("D1").End(xlDown)), _ ...

Script error found during opening Dynamics
I just upgrade to the latest Canada Payroll tax update, when one of the user who sign on to Dynamics after upgrade, she got the "Internet Explorer Script Error" window pop up and saying "An error has occurred in the script on this page" Line: 335 Char: 6 Error: The data is invalid Code: 0 URL: file:///C:/Documents%20and%20Settings/UserA/Local%20Settings/Temp/tmpAD1.tmp I tried to clear all the temp file in this folder but still no luck to get rid of this message during loading Dynamics. I asked the user to click on "Yes" button to continue "D...

Order Name J Script
Hi I want to automatically populate the order name to customer name + date. This is the script I have but it shows the dayand time etc. I want to format the date such that it is dd-mm-yy format. How do i go about this please? var lookupItem = new Array; lookupItem = crmForm.all.customerid.DataValue; var d = new Date(); if (lookupItem[0] != null) { crmForm.all.name.DataValue = lookupItem[0].name +" : " + d; } You might want to take a look at the snippets below to munipulate datetimes. http://snippets.dzone.com/posts/show/932 Darren Liu, Microsoft CRM MVP Crowe http://www.cro...

VBA script help..Please !!!!
I have been given the script below by Ron De Bruin - and I can't thank him enough, however I'm still scratching my head as it doesn't EXACTLY what I want. I want ALL the built in command bars/toolbars etc that are shown in a normal excel sheet to be hidden when I open my 'Log' - EXCEPT my own personal toolbar named 'LOG' and the 'Worksheet Menu Bar'. 2 problems arise from the script below :- 1) The Worksheet Menu Bar is displayed, but my 'LOG' toolbar is not. 2) If I open another seperate excel sheet, all the same commands have been copied to...

vba Search Script for outlook?
I'm looking for some way to script a search for approximately 35 keywords within a PST file... I would like for the script to create a subfolder for each key word, then place a COPY of any message found withing the PST into the associated subfolder.. Anyone ever do anything like this before?? Troy ...

Script running other scripts return values
hello I've got series of VB scripts that I run manually buy clicking on them, Can't I have one script that runs all of them? I would want to check a returned variable to is one script has a failure, the later one won't get executed. Can't I just use the .Run method? How do I return a value from one script, and read it in the other script? Thanks "Bill" <someplace@somewhere.com> wrote in message news:e72gZtg7KHA.5644@TK2MSFTNGP04.phx.gbl... > hello > > I've got series of VB scripts that I run manually buy clicking on...

Business Portal Script Error
I've got Business Portal v1.2 and I have a user trying to add a new page. When he runs the wizard to create the new page, he gets a script error. The error is: A DLL initialization routine failed. http://server/BusinessPortal/UI/ClientCommon/Scripts/mbftreeview.htc He can't finish the wizard. Do I need to re-install something on the server? Thanks, John Does the user have the correct permissions? Click on Site settings and see if the user has te correct permissions. Might be worth adding the page as a user who is a administrator in BP. James "AnytimeAnywhere" <...

ANy script for this?
Hi all, I need to run the script on our file servers to get Last Acesses Date more than 180 days. It should search the sub-folders too. Windows 2003 server. Thank you. "ed" <ed@discussions.microsoft.com> said this in news item news:4FF557C4-643F-4EB1-9738-AF22E0F1693E@microsoft.com... > Hi all, > > I need to run the script on our file servers to get Last Acesses Date more > than 180 > days. It should search the sub-folders too. > Windows 2003 server. > > Thank you. Use the code you received in the Server group, leaving &...

Backup Script
http://www.mvps.org/money/backup.htm I am trying to implement the advanced backup script for Microsoft Money that Cal posted a link for a few days ago (see link above). I work with batch files all the time so don't respond unless you have an intelegent answer to my question. In the script below, does anyone know why "attrib -r ..." line is there? As far as I know, that would only show you the attributes of the file. If the file isn't there, it just causes the batch to fail. I am going to remove it from my batch file so it will run, but I am trying to find out if there is...

SendKeys in VB6 (and Windows Script Host)
Microsoft has committed to support VB6 applications in Vista and Windows 7. However, it appears that support for VB Sendkeys is still lacking. The latest updates for Windows Vista and Windows 7 appear to support Sendkeys ONLY if UAC is turned off. For customers who use an older (VB6) version of our product who still insist on installing Windows Vista and Windows 7, currently the only solutions we can offer is to turn UAC off--which is unacceptable for some. This prevents users from potentially updating thousands of workstations. I hope to discover if and when Microsoft w...

Get The ID of the Parent object in client side script
So If I called the URL http://sandbox/userdefined/areas.aspx?oId={AFBCB664-BBBD-DA11-9864-001320020C86}&oType=10005&security=852023&tabSet=areaActivities to view the list of Activities for a custom enetity and then clicked the new button or doubled on an exsisting activity. In the onload event of the activity I would like to get the parentid for my custom entity? Is there a way using crmForm or some other object to get the parent entity for this activity? I don't want to use regardingid. Is there any link back to the grid of Activities I called? Mike ...

which line mercy script
Going Blind... is there a code for hiliting a row when any cell in that line is selected. Thanks............. P.S.: If can, example with both of: - grey hilite same as when select row on left, - & a double wide border. "nastech" wrote: > Going Blind... is there a code for hiliting a row when any cell in that line > is selected. Thanks............. You could try this in the worksheet's SelectionChange event: Private Sub Worksheet_SelectionChange(ByVal Target As Range) ' clear any previous highlighting Columns(1).EntireRow.Interior.ColorIndex = ...

is there a script for this?
Hi all, There is folder we stored the backup files and we only need to keep 15 days data. Is there a way to do this automatically to only keep data for 15 days? windows 2003 R2 and files with extension .bak Thank you. You could write a batch file and run it in Windows scheduler. @Echo off del c:\FolderName\*.bak /Q "ed" <ed@discussions.microsoft.com> wrote in message news:0F0B1239-DFDA-4537-AA6F-D5CED8E5214C@microsoft.com... > Hi all, > > There is folder we stored the backup files and we only need to keep 15 > days > data. Is t...

Logon script
Making a logon script for two locations and want the script to understand what location is logged on to. I can determen this with %logonserver% but is there any properties in vb script that gives me the same function? Or any other suggestions. -T "Terry" <terje@itl.no> wrote in message news:%23mVurU8aKHA.4688@TK2MSFTNGP06.phx.gbl... > Making a logon script for two locations and want the script to understand > what location is logged on to. > I can determen this with %logonserver% but is there any properties in vb > script that gives me th...

Submit Button Script
I am having issues with the submit button on my Publisher 2003 form. When I ftp my pub files, after setting the form properties to send the results to my email addy, I get an error 404 page cannot be found. Here is the script it is displaying when I open the edit page function with FP 2003: <form action=--WEBBOT-SELF-- method=POST> <!--webbot bot="SaveResults" s-email-address="info@bohemianhouseproductions.net" s-email-format="TEXT/PRE" b-email-label-fields="TRUE" s-email-Subject="Web Site Form Response" s-builtin-fields...

Scripting Error
This is a multi-part message in MIME format. ------=_NextPart_000_02F8_01CB2F41.80988510 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Recently I have started to receive scripting errors on certain emails or = newsgroup posts It is an IE error that generally has something like: ---------------------------------------------- Line: 1 Char: 2 Error: '_gat' is undefined Code: 0 URL: mhtml: mhtml:{EF0CF749-0D42-4C4B-B021-20786141361F}mid://00000756/' Do you want to continue running scripts on this page? ---...

Embedded IE7 browser object
We have an MFC app that embeds the WebBrowser ActiveX control. Starting in IE7, we've been getting a scripting error due to an exception closing a window that the user has already closed for pages that we display in this WebBrowser control. This doesn't happen when the same page is viewed in Internet Explorer 7, nor does it happen in either situation on computers with IE5-6. The following is a JavaScript example that recreates this situation: var winName = "myWin"; var theURL = "http://www.microsoft.com"; var objWin = window.open(theURL, winName); // U...

capture sql logins script
Hello everybody - For disaster recovery purposes we have a secondary gp server on standby. How can I set it up so that the 'caputure sql logins' script will run on my primary gp server and then save the results to the secondary backup gp server? What tool should I use and is there an automatic script I can use? You may approach this in few different ways - 1) Use PSTools to recreate users on the secondary server. This is a free tool and is part of the Professional Services Toools Library. 2) Export out users in a file and run this file using task scheduler and SQL command utility ...

Script to populate table
Hi all in SQL Server 2008 is there a way to create a script that populate me a table with the data contained in an equal table present in another database?. Thanks a lot Luigi On Wed, 10 Feb 2010 06:31:02 -0800, Luigi <Luigi@discussions.microsoft.com> wrote: > >Hi all >in SQL Server 2008 is there a way to create a script that populate me a >table with the data contained in an equal table present in another database?. > >Thanks a lot > >Luigi insert mytable select * from otherdatabase.dbo.othertable As posted, the poor-man's version...

Copy-paste scripting bug?
Hi, I am trying to copy an object from Visio and paste it to Word using Visual Basic scripting. I want the copied object to be pasted as an enhanched metafile. No matter what I use as a destination data type, the object ends up be pasted as an embedded Visio object. Manual pasting works fine. Is there a workaround for this? My code: Sub DoCopyPaste() ' sadfsdf ' sdfsfsfs ' Get Running Microsoft Word Set wordApp = GetObject(, "Word.Application") ' Get Running Microsoft Visio Set visioApp = GetObject(, "Visio.Application") ...

SCRIPT
I need script to delet sold srial ? Can anyone help ? -- gill1@att.net ...

Problem of Deployment Office 2007 by using GPO Startup Script
Hi All, I'm now trying to deploy Office 2007 by using GPO Startup Script. However the script returns "Permission Denied" to me. I follow the instruction in TechNet to assign the network share with "Read, Read & Execute, and List" permission to "Domain Computers" object. The script is working fine in Logon script. Wondering what is the problem.... thanks for everyone help. Ricky ...

Script to find local administrators on workstations...
I want to write a script that will pull the name of a workstation and the local administrators off the box. ** If i need to run an ldap script and get the name of the boxes first then i'll do that first then run the script that will pull the names off and link them to the box their associated with. Thanks everyone in advance. Ryan "RBoyle" <ryan.j.boyle.cpg@gmail.com> wrote in message news:cb6433a4-99b8-49e2-9fd2-e308e0d1e009@n31g2000vbt.googlegroups.com... >I want to write a script that will pull the name of a workstation and > the local administr...

Trigger / Script
Trying to automate a process - everytime we receive an item for a specific depart -we have to create two ILC - one for the item itself and another of a kit item. ILC 19-123 original item Type Standard, etc...) ILC 19-123FQ - kit of ILC 19-123 Type kit, same taxes as original item, same department as original item, category always FQ, under KIT tab - select original item qty .25 build qty 2 Is their a way to automate this process via a script or trigger. Danny hi, Yes possible using the store procedure or database level trigger. but it require the detail analysis, i.e. what happen ...