Script to archive File Server Data

Hi All,
  I'm looking for a script to remove the file server data by keeping last 2 years?
As

Hi As,
In addition, To delete old files based on the datetime via Powershell, please refer to the script below, which will delete files created older than 2 years in the folder:
$years=2
$limit = (Get-Date).Addyears(-$years)
$path = "e:\file"
# Delete files older than the $limit.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force -whatif
The -whatif parameter will list the files which will be deleted by running the the cmdlet remove-item but do not execute the deletion.
If there is anything else regarding this issue, please feel free to post back.
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • Oracle script to extract SQL server data to XML/CSX file format

    HI,
    I have a requirement like-
    Create an Oracle script to Extract data from SQL Server to XML/CSV file format in File server (Oracle Server and File Server are in different boxes).
    Create an Oracle script to Retrieve data from the File Server, validate and load into the Oracle staging table
    Create an Oracle script to Push data from Oracle Staging table to native SQL Server table
    We may/may not be using the staging table
    Could anyone please respond immediately as it is urgent ?
    Thanks,
    Inbamalar

    user10594152 wrote:
    HI,
    I have a requirement like-
    Create an Oracle script to Extract data from SQL Server to XML/CSV file format in File server (Oracle Server and File Server are in different boxes).
    Create an Oracle script to Retrieve data from the File Server, validate and load into the Oracle staging table
    Create an Oracle script to Push data from Oracle Staging table to native SQL Server table
    We may/may not be using the staging table
    Could anyone please respond immediately as it is urgent ?
    Thanks,
    Inbamalar
    Urgent issues indicate a live/production system is having problems and a company is losing money, or customers are being prevented from using it.
    For urgent issues you should raise your issue with Oracle Support using your customer support identifier.
    The community forums are for non-urgent issues.  To suggest such issues are urgent is considered rude, as the people who help here are volunteers with their own jobs to do, so demanding their time for your "urgent" issue is not appropriate.  It also suggests that you think your issue is more important than other people's issues, so you are being rude to those people too.  Your issue is no more important than anyone elses.
    In relation to your question, you need to provide more information.
    Please read: Re: 2. How do I ask a question on the forums?
    When you refer to "SQL Server" are you referring to the Microsoft SQL Server product, or are you just referring to a physical server with your oracle database on it?

  • Migrate File Server data from one volume to another

    I am looking for the best way to handle this situation. We have a VHD that has a 4KB cluster size that is getting close to the 16TB mark so no expanding past that due to the cluster size. In the past whenever i needed to pull this off i would preload as
    much data as possible with robocopy, then during a maintenance window take the share offline, do a refresh with robocopy then flip everything that i needed to flip drive letter and share setup etc.
    I have the space to do a complete copy like this so that is not an issue. But other things to keep in mind are the data is deduplicated so we are talking 20TB total. The other is the backup of the File Server is done at a file level with DPM so DPM will
    see this as a new volume and be an issue.
    At this point i have time to plan and am just looking for ideas.

    Hi,
    If you want to copy files/folders from one Volume to another volume, you could use the File Server Migration Tool (FSMT) or Robocopy to accomplish.
    The tool can move all of the files from the shares on your original volume to the new volume.
    FSMT and Robocopy will not copy Share permissions but only NTFS permissions. So if the drive letter will not be changed, you can backup and restore the Share permission with steps here:
    Saving and restoring existing Windows shares
    http://support.microsoft.com/kb/125996
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Extractors for Archive files & online data

    Hi experts,
    I have requirements to develop extractors to extract both ADK files and online data for MM and PS. Online PS data were extracted previously through generic extractors with FM (F2) and MM with generic extrator with View
    I identified the table MSEG, MKPF for MM and MSEG for PS were the data need to be pull from. The ADK files reside in a file system and are accessible through PBS index.
    1- Could you pl guide me through a strategy how to proceed?
    2- Is possible to develop a generic datasource with function module that with be able to fetch ADK files & online data for PS
    3- For MM, I am thinking at 2LIS_03_BF since I am extracting MM: Material movements
         Since that extractor is delta capable but I am looking for full upload, could you pl provide steps how to work around that if possible?
    Thanks.

    Thanks for replying,
    I have already reviewed that document, it is not helpful in my case since I can retrieve archive data using PBS index. I think that I have to develop a FM extractor capable to fetch online and archive data for appl. comp. PS.
    Several fileds need to be accessed on tables MSEG, AFKO, AFVC, EBAN, ESLL, ESLH, t430...
    I already have a FM module capable to fetch online data... I need to modify it so that it would fetch online and archive data...
    I am looking here for the logic ... could you please experts paste a template code capable to fullfill that requirement or sent it under (blaise.pascal(at)ymail.com) I will really appreciate.
    Edited by: Blaiso on May 12, 2011 7:27 PM

  • Migrating single file server to failover cluster file server

    Hi,
    Currently we have one file server which is our Domain controller also. File Server data stored in SAN storage lun. Users home folders also resides at file server.Now we want to create 2 node failover cluster file server.
    Questions:
    1)Can we assign same storage lun to failover cluster?
    2)Do we need to assign all permissions and storage quota again?
    What is the best option to achieve this goal.                                                                            

    Hi,
    if you attach the same LUN to the failover cluster the NTFS permission (security tab) are retained because they are stored in the LUN itself
    Share permission are lost because they are stored in the registry of the file server. If you have few share with a simple share permission structure, simply recreate them in the cluster. If you have a lot of shares and complex permission tree, you have to
    export registry hives related to lanmanserver\shares

  • File Server Migration Source and Target Data Validation

    Does anyone know of a power shell script/CLI command  or some other way to verify source and target data after a file server migration?  I want to make sure that the shares that are migrated from the source and target are an exact match. Thank
    you.

    Hi,
    An example is provided in this article:
    http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/08/easily-compare-two-folders-by-using-powershell.aspx
    $fso = Get-ChildItem -Recurse -path C:\fso
    $fsoBU = Get-ChildItem -Recurse -path C:\fso_BackUp
    Compare-Object -ReferenceObject $fso -DifferenceObject $fsoBU
    And actually Robocopy could also do this job with /L and /log:file parameter. 
    If you have any feedback on our support, please send to [email protected]

  • Problem in Archiving File From FTP Server to XI File Server Using FCC

    Hi,
    The scenario is file to IDOc. XI has to read the input file from client FTP server and archive it to XI local file server. Archiving on XI server is working fine without FCC (for xml files). But with FCC, the sender FTP adapter is archiving empty files (0 kb files).
    I've checked SXMB_MONI, even there I can see the file data and the IDoc is getting posted with proper data. But, the archived file is empty. Not sure about the problem.
    Please suggest. Thanks in advance.
    Regards,
    Joe.

    Hi,
    File adapter has the functionality which support the empty file handling.
    Handling of Empty Files
    Specify how empty files (length 0 bytes) are to be handled.
    ○ Do Not Create Message
    No XI messages are created from empty files.
    The files are processed according to the selected Processing Mode.
    For example, if the processing mode is Delete, empty files are deleted in the source directory.
    ○ Process Empty Files
    XI messages are created with an empty main payload.
    The files are processed according to the selected Processing Mode.
    ○ Skip Empty Files
    No XI messages are created from empty files.
    Empty files are skipped and remain in the source directory.
    refer the belwo link:
    http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
    reward points if helpful*
    thanks
    SAPXI

  • How to archive files in another ftp server?

    Hi,gurus:
       My scenario is file to file and my sender adapter is ftp adapter.
       Now I want to archive the send file in another ftp server,how can I  implement it?
       There is a parameter "Archive files on FTP server" when I choose the processing mode "archive".What's  it's use?Thanks in advance.

    Hi,Santhosh:
      Thanks for your reply.
      I have checked your blog before,and it is very useful for me.
      I still have a problem about command line.
      In an sap note,I found the principle of the execution of the command line is like below code:
    import java.util.*;
    import java.io.*;
    public class test {
    public static void main(String args[]) {
    try {
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("C:/data/test.bat <param1> <param2>");
    } catch (Exception e) {
    e.printStackTrace();
    But you know this method has restriction.If my bat file has many commands,it only execute a part of commands(sometimes 8,sometimes 9 ).
    My bat file is like below:
    echo open 192.168.67.149 >c:
    data
    copyResult.txt
    echo <username> >>c:
    data
    copyResult.txt
    echo <password> >>c:
    data
    copyResult.txt
    echo cd /receive>>c:
    data
    copyResult.txt
    echo get %2>>c:
    data
    copyResult.txt
    echo cd /ok>>c:
    data
    copyResult.txt
    echo put %2>>c:
    data
    copyResult.txt
    echo cd /archive>>c:
    data
    copyResult.txt
    echo delete send.txt>>c:
    data
    copyResult.txt
    echo quit >>c:
    data
    copyResult.txt
    ftp -s:c:
    data
    copyResult.txt
    del %2
    I wanna merge all the "echo" in one command,so it may execute successfully,but I don't know the method.Any ideas?

  • Archiving file in application server

    Hi
    Can anybody of you please let me know how to archive a file from one directory to other in the application server?
    I dont want to read one file into an internal table and then loop on that to create a new file.
    Looking for some FM or command that would do this in one shot.
    Any clue is very appreciated
    Best Regards
    Chinmou

    My  friend   there is   no   such  one program which will  do  archive  or   one function  module which  will do  as you wanted  .
    Basicall  for archiveing the data   into file  it requesite 4  basic function  modules  as .
    code] "ARCHIVE_OPEN_FOR_WRITE'
    "ARCHIVE_NEW_OBJECT'
    "ARCHIVE_GET_STRUCTURES'
    "ARCHIVE_SAVE_OBJECT[/code]    
    so  based up on the archive  obect   it will have  own  write  program  which will   use  above  4  function  modules  and  collects the  table data from the basic  archiveing  obecjt  from  the   AOBJ  tcode  archive object structure then  creates  struture for that data and then  write's  it .
    so below  is the logic  .       
    CALL FUNCTION 'ARCHIVE_OPEN_FOR_WRITE'
        EXPORTING
         call_delete_job_in_test_mode        = 'X'
         create_archive_file                 = 'X'
          object                              = v_arch_obj
         comments                            = 'ILM test FILE'
    *   DO_NOT_DELETE_DATA                  = ' '
    *   OUTPUT_SEL_SCREEN_WHEN_DIALOG       = 'X'
    *   OUTPUT_SEL_SCREEN_WHEN_BATCH        = ' '
       IMPORTING
         archive_handle                      = v_handle
    * EXCEPTIONS
    *   INTERNAL_ERROR                      = 1
    *   OBJECT_NOT_FOUND                    = 2
    *   OPEN_ERROR                          = 3
    *   NOT_AUTHORIZED                      = 4
    *   OTHERS                              = 5
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *This function module should always be called when a new data object is
    *to be prepared for writing to an archive.
      CALL FUNCTION 'ARCHIVE_NEW_OBJECT'
        EXPORTING
          archive_handle                = v_handle
    *   OBJECT_ID                     = ' '
    * EXCEPTIONS
    *   INTERNAL_ERROR                = 1
    *   WRONG_ACCESS_TO_ARCHIVE       = 2
    *   OTHERS                        = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ** get the structures for the archiving object
    *** loop through that
      CALL FUNCTION 'ARCHIVE_GET_STRUCTURES'
        EXPORTING
          archive_handle                = v_handle
        TABLES
          record_structures             = it_structures
    * EXCEPTIONS
    *   WRONG_ACCESS_TO_ARCHIVE       = 1
    *   OTHERS                        = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    i_stru-PARLIST[] = i_par_list[].
    * writing data object into the archive file
      CALL FUNCTION 'ARCHIVE_SAVE_OBJECT'
        EXPORTING
          archive_handle                = v_handle
    * IMPORTING
    *   OBJECT_OFFSET                 =
    *   ARCHIVE_NAME                  =
    * EXCEPTIONS
    *   FILE_IO_ERROR                 = 1
    *   INTERNAL_ERROR                = 2
    *   OPEN_ERROR                    = 3
    *   TERMINATION_REQUESTED         = 4
    *   WRONG_ACCESS_TO_ARCHIVE       = 5
    *   OTHERS                        = 6
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    reward  points if it is usefull ...
    Girish

  • Script for moving files and directory to archive

    Hi,
    I've search the web for good working script to archive my files and folder with no luck.
    do you have a script that move and preserve the structure of older files and folders that have not been accessed for X days?

    Hello, I found this quite quickly in the TechNet Gallery. It seems like it would do what you're looking to do.
    https://gallery.technet.microsoft.com/Archive-old-files-with-042f859a
    # Powershell script - move old files to an archive location.
    # Writes log files to $logpath
    # Ver 0.6
    $path = "C:\TEMP"
    $archpath = "D:\TEMP-ARCH"
    $days = "30"
    $logpath = "C:\Temp"
    $date = Get-Date -format yyyyMMddHHmm
    write-progress -activity "Archiving Data" -status "Progress:"
    If ( -not (Test-Path $archpath)) {ni $archpath -type directory}
    Get-Childitem -Path $path -recurse| Where-Object {$_.LastWriteTime -lt (get-date).AddDays(-$days)} |
    ForEach { $filename = $_.fullname
    try { Move-Item $_.FullName -destination $archpath -force -ErrorAction:SilentlyContinue
    "Successfully moved $filename to $archpath" | add-content $logpath\log-$date.txt }
    catch { "Error moving $filename: $_ " | add-content $logpath\log-$date.txt }

  • How can i retrieved data into the infocube from archived files

    hi,
    i have archived cube data and i have to load data into the cube from archived files.
    so now i want to find archived files and how to load data into the cube.
    thanks

    Hi.....
    Reloading archived data should be an exception rather than the general case, since data should be
    archived only if it is not needed in the database anymore. When the archived data target is serving also as a
    datamart to populate other data targets, Its recommend that you load the data to a copy of the original
    (archived) data target, and combine the two resulting data targets with a MultiProvider.
    In order to reload the data to a data target, you have to use the export DataSource of the archived data
    target. Therefore, you create an update rule based on the respective InfoSource (technical name 8<data
    target name>). You then trigger the upload either by using ‘Update ODS data in data target’ or by
    replicating the DataSources of the MYSELF source system and subsequently scheduling an InfoPackage
    for the respective InfoSource
    If you want to read the data for reporting or
    control purposes, you have to write a report, which reads data from the archive files sequentially.
    Alternatively, you can also use the Archiving Information System (AS). This tool enables you to define an
    InfoStructure, and create reports based on these InfoStructures. The InfoStructures define an index for
    the archive file data. At the moment, the archiving process in the BW system does not fill the
    InfoStructures during the archiving session automatically. This has to be performed manually when
    needed.
    Another way of displaying data from the archive file is by using the ‘Extractor checker’ (TCODE RSA3).
    Enter the name of the export DataSource of the respective data target (name of the data target preceded
    by ‘8’), and choose the archive files that are to be read. The extractor checker reads the selected archive
    files sequentially. Selection conditions can be entered for filtering but have to be entered in in internal
    format
    It will remain same in the change log table.
    Check this link :
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b32837f2-0c01-0010-68a3-c45f8443f01d
    Hope this helps you...........
    Regards,
    Debjani............

  • Script to make a file inventory on a file server

    Hello
    To accomplish a company audit, I have to create a script that scan our windows 2003 standard file server and create a report with a list of certain files type like mp3, video and so on. In the list have to be present path, file name, and file owner.
    I already searched on Google, but I don't find anything usable.
    Someone could help me ?
    Thanks
    Raven

    I like that, except I'd change out FullName for Directory and maybe add the size, which is usually helpful in a storage audit. 
    $searchdir = "d:\ShareRoot","e:\ShareRoot"
    $ext = "*.mp3","*.wma" ## etc etc
    $searchdir | % { gci $_ -recurse -include $ext | select Name,Directory,@{Name="Size in MB";expression={$_.Length / 1mb}},@{Name="Owner";expression={$_.getaccesscontrol().Owner}}} | Export-Csv C:\DirResult.csv -notype
    Thanks, this is a very useful script. How could the output be amended to also include file creation and modification date?

  • Change the storage server of archiving files

    Hello Gurus,
    I have archiving files in iseries storage, but because the disks in iseries servers is very expensive i want to change the storage server to Intel server with Win2003 or Linux S.O.
    This change is posibble? i would appreciate your suggestions.
    Regards,
    Ernesto Castro.

    Hi,
    With my understanding about accessing the archive data from the storage system, i can say that it is possible.
    1. First you should check with archive server vendors (such as opentext or Documentum) whether their application will support in this scenario.
    2. When you are relocating the archived data from one storage to another storage system then the link between the archived data and the physical path will be disconnected.
    Solution: A. create a content repository of new location and assign this content repository to all the archiving objects that are affected.
    B. Delete the build Infostructure for the archiving objects and after assigning the new content repository build the infostructure again and try to access the archived data.
    Hope this mail could help you.
    -Thanks,
    Ajay

  • Transfer data from File server to SAP R/3 AS

    hi, i need to transfer data from file server (http:/.....) to SAP R/3 application server. I have the HTTP Host name (http:/......) and login details. please let me know how i can resolve this.
    best regards
    Neeraj

    Hi
    You need to create a RFC Destination with the details what you have, then you can create a RFC Fucntion module to read the data, according to the destination system, you have to code that, once you
    pick the data from the destination system, later you need to convert it to SAP Format.
    To trace your fm status, there are function module availabe in sap, search with http, you can find.
    regards
    Praveen

  • A script for adding the current date to file name?

    I am working in Indesign CS3. I frequently save file as PDFs into a designated folder. I was hoping for help in writing a script that would apply the current date to the end of the file name, when saved into this folder. Some days, I save the same file several times, into this folder. I was also hoping there was a way to add a date and version, for example "filename_2.25.11(1).pdf" Is this possible? Can someone help me?

    ok, I ended up with this test routine:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    repeat with this in added_items
    my checkifopened(this)
    display dialog (name of this) as text
    end repeat
    end tell
    end adding folder items to
    on checkifopened(this)
    set a to POSIX path of (this as alias)
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    exit repeat
    else
    say "still opened"
    end if
    end repeat
    end checkifopened
    this is a folder action that tests if the added file is still opened by an application... there is no delay between each test-loop since lsof takes some time to execute...
    And after adding a timeout (just in case) to this function the final script looks like this:
    on adding folder items to thefolder after receiving added_items
    tell application "Finder"
    set folderkind to kind of thefolder
    set myfiles to every item of thefolder whose name does not contain "#" and kind is not folderkind
    repeat with myfile in myfiles
    set myfile_datestring to my get_datestring(creation date of myfile)
    set myfilename to name of myfile
    if (count of every character of myfilename) > 4 and (character -4 of myfilename) as text is "." then
    set filestatus to my checkifopened(myfile, 60)
    if filestatus = false then
    display dialog "timeout on folder action"
    else
    set tmp to ((characters 1 through -5 of myfilename) & "#" & myfile_datestring & (characters -4 through -1 of myfilename)) as text
    set myfilename to my checknamewith_pdfsuffix(tmp, thefolder, false)
    set name of myfile to myfilename
    end if
    end if
    end repeat
    end tell
    end adding folder items to
    on get_datestring(mydate)
    return year of mydate & "-" & (characters -2 through -1 of (("0" & (month of mydate as integer)) as text)) & "-" & (characters -2 through -1 of (("0" & (day of mydate as integer)) as text)) as text
    end get_datestring
    on checknamewith_pdfsuffix(n, D, looped)
    --check if filename exists in D
    -- so if "A File.pdf" exists it names it "A File 1.pdf","A File 2.pdf",...
    #n = string of the filename
    #D = file reference to the directory to check
    #looped = boolean used for recursive loop...
    tell application "Finder"
    set thefiles to name of every item of (D as alias)
    end tell
    if thefiles contains n then
    if looped = false then
    set n to ((characters 1 through -5 of n) & "(1)" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    else
    set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
    set tmpcount to (count of characters of (tmp as text)) + 5
    set tmp to tmp + 1
    set n to ((characters 1 through (-1 * tmpcount) of n) & "(" & tmp & ")" & (characters -4 through -1 of n)) as text
    my checknamewith_pdfsuffix(n, D, true)
    end if
    else
    return n
    end if
    end checknamewith_pdfsuffix
    on checkifopened(this, mytimeout)
    ## this file reference
    ## timeout in seconds
    set a to POSIX path of (this as alias)
    set startdate to current date
    repeat until 1 = 0
    ## don't like that one because it relies on an error msg ... so
    (** try
    set b to do shell script "lsof | grep " & quoted form of a
    on error
    exit repeat
    end try**)
    ##so I use this one
    set b to do shell script "lsof"
    if b does not contain a then
    return true
    else if ((current date) - startdate) > mytimeout then
    return false
    else
    ##say "still opened"
    end if
    end repeat
    end checkifopened
    to use this save this script in /Library/Scripts/Folder Action Scripts
    and add this as a folder action to your folder...
    The script processes all files inside that folder each time a new files is added...

Maybe you are looking for

  • I have an Array of objects and  want to add an ArrayList of a different ob

    could someone please help me out with this one, when the table is created i need create one new pile to each element of this array create one new block for each pile add a block to the pile the block is an arraylist the block and pile classes have al

  • Mountain lion crashed my computer. I have a gray screen and that's it. Help!!!

    Montaigne lion crashed my MacBook  I get nothing but a gray screen

  • Submit Button Function

    I can't get my form to display the data input after clicking on the submit button. Here's what I'm trying to do. I've created a super basic form in html and it's displaying properly in IE the way I want it to. The form consists of drop down boxes for

  • Failover properties set at dvswitch level??

    I am looking to define an explicit failover order for all dvportgroups created from within vcloud director 5.1 as to control traffic flow across cisco UCS fabric interconnects. Is there a way to set the defaults at the dvswitch level so all created d

  • How to install games without a data connection

    have a curve 8520. i do not have a data connection, no service provider. i only use wifi and connect to my desktop via usb. how is the best way to install games. can i download from bb app world? i have tried downloading from other places but the gam