Rotate File with Date Stamp and Zip

Hey Guys
New to powershell.. Just want to write a simple script to do the following. The file is called D:\test.log
1) Rotate it every night at 12pm (I guess schedule via task manager)
2) Rename it to YYYY-MM-DD-filename.log at that time. Create a new file called test.log so current logging can continue (or just keeps running on that file after rename of file)
3) Zip it. and leave it there..
Can anyone help on how to do so? And also if I want to expand this script to do multiple files (but same rotated file format), that would be helpful (I guess some for each statement ? )
Will run on Windows 2008 R2 Servers..
Appreciate your help!!!

Here is a good place to start:http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
Look at how to manage dates and how to manage files.
When you have a start and get stuck post back with a specific question.
You can learn to write a script in PowerShell in less than a weekend if you start with the introductory videos.
¯\_(ツ)_/¯

Similar Messages

  • File Adapter : read XML file with data validation and file rejection ?

    Hello,
    In order to read a XML file with the file adapter, I have defined a XSD that I have imported to my project.
    Now the File Adapter reads the file correctly but it does not give an error when:
    - the data types are not valid. Ex: dateTime is expected in a node and a string is provided
    - the XML file has invalid attributes.
    How can I manage error handling for XML files ?
    Should I write my own Java XPath function to validate the file after is processed ? (here is an example for doing this : http://www.experts-exchange.com/Web/Web_Languages/XML/Q_21058568.html)
    Thanks.

    one option is to specify validateXML on the partnerlink (that describes the file adapter endpoint) such as shown here
    <partnerLinkBinding name="StarLoanService">
    <property name="wsdlLocation"> http://<hostname>:9700/orabpel/default/StarLoan/StarLoan?wsdl</property>
    <property name="validateXML">true</property>
    </partnerLinkBinding>
    hth clemens

  • Can someone help with a previous post labeled "Writing to a data file with time stamp - Help! "

    Can someone possibly help with a previous post labeled "Writing to a data file with time stamp - Help! "
    Thanks

    whats the problem?
    Aquaphire
    ---USING LABVIEW 6.1---

  • How to Run Export and Make Dump and Log File with Dates on NT

    Hi Gurus,
    set ORACLE_SID=ORCL
    set ORACLE_HOME=D:\ORACLE\ora92
    for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do
    set fdate=%%a%%b%%c
    exp userid=userid/password@connectstring
    file=exp%fdate%.dmp log=exp%fdate%.log full=y
    I am using above script for export and make dump file with dates, but when i am excuting this script with Schedule task i am getting error.
    C:\Documents and Settings\krishna>for /f "tokens=2,3,4 delims=/ " %%a in ('date
    /t') do
    %%a was unexpected at this time.
    Help is highly appriciated.
    Thanks & Regards
    praveen

    HOST('EXP80 MRPAY/MRPAYS FILE=D:\BACKUP\MRPAY'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=MRPAY CONSISTENT=Y');
    HOST('EXP80 SECSYS/SECSYS FILE=D:\BACKUP\SECSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SECSYS CONSISTENT=Y');
    HOST('EXP80 SICPA/SICPA FILE=D:\BACKUP\SICPA'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPA CONSISTENT=Y');
    HOST('EXP80 SICPAINVSYS/SICPAINVSYS FILE=D:\BACKUP\SICPAINVSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPAINVSYS CONSISTENT=Y');
    HOST('EXP80 SICPAGLSYS/SICPAGLSYS FILE=D:\BACKUP\SICPAGLSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPAGLSYS CONSISTENT=Y');
    HOST('EXP80 SICPAPURHSYS/SICPAPURHSYS FILE=D:\BACKUP\SICPAPURHSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPAPURHSYS CONSISTENT=Y');
    HOST('EXP80 SICPARECSYS/SICPARECSYS FILE=D:\BACKUP\SICPARECSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPARECSYS CONSISTENT=Y');
    HOST('EXP80 SICPASECSYS/SICPASECSYS FILE=D:\BACKUP\SICPASECSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=SICPASECSYS CONSISTENT=Y');
    HOST('EXP80 FASYS/FASYS FILE=D:\BACKUP\FASYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=FASYS CONSISTENT=Y');
    HOST('EXP80 ATTSYS/ATTSYS FILE=D:\BACKUP\ATTSYS'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=ATTSYS CONSISTENT=Y');
    HOST('EXP80 ATTENDANCESYSTEM/ATTENDANCESYSTEM FILE=D:\BACKUP\ATTENDANCESYSTEM'||TO_CHAR(SYSDATE,'DDMMRRHH24MI')||'.DMP OWNER=ATTENDANCESYSTEM CONSISTENT=Y');
    Arshad

  • Moving multiple files by date range and/or file name filtered

    I need to move multiple files by date range and/or by filename (using a filter) to another directory. 
    OR
    How can I get the attributes of files in a directory, something you would see when typing in "dir" in a DOS or ls in UNIX.  I can parse this info and then make a array of files to move.
    The reason for needing this is that I need to move files that are located in another country, and sort them into different directories based on date.  Having to read each file for it's file information adds wasted time that I can't afford.  I am about to create a dos terminal to do a "dir" command to get the information and parse it out.. but I was hoping LV had a function that can get me that info so I don't have build it.
    THanks.

    You should use the 'File/Directory Info' functionality.
    This will return the last modificatoin of the file.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • EEnvelope with Date Stamp

    I am using the eEnvelope with Date Stamp to send
    secure email attachments.  It works great, however, the timestamp that appears on the
    envelope has no relationship to the time at which the enve
    lope was created.  Is this just the way it works or is there a way to make the time appear as the actual time of creation of the envelope?

    Hello rgille,
    Thank you for your post.
    You should know that these forums are specific to the
    Acrobat.com website and its set of hosted services, and do
    not cover the Acrobat family of desktop products.
    Any questions related to the Acrobat family of desktop
    products would be best suited in the Acrobat Forums:
    http://www.adobeforums.com/cgi-bin/webx/.3bbeda8b/
    Thanks!
    Pete

  • Saving a file with data?

    HI, I am wanting to save a file with data, can some one point me in the right direction to a tut or some thing. Thanks.
    OR
    if they could be so kind as to code a simple thing that saves a file (txt) with a word. This would make my day,
    Thansk and all the best Jonathan :o).

    I have sorted what I was wanting to do. there was some code missing from the coding as well as the import function.
    No you don't have to be 'god' but if some one just handed you a russian/english dictionary you would still have a difficult time making a sentance or even a DVD with every thing there is to know speaking gaelic.
    You have to learn more than just the syntax. sorry I'm not the best person in the world for understanding docs etc, but we all have our good points, ask me any thing else on computers and networks I'll give a plain english answer, wood chips and all.
    This is all meant in a good tone, there is the problem with txt that it tend to have a dull sound, so cheer up and smile. I know I am.
    :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o)
    :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o) :o)

  • Need to rescue Garage Band Files with Data Rescue II - what kind of files?

    Hi all -
    After a particularly gruesome computer crash, I am trying to reconstruct my lost files using Data Rescue II..... This program goes into the damaged hard drive and downloads all intact files it can find, but it is NOT able to label everything correctly. All it can do is divide things into folders - Audio files, document files, images, mail, misc., and movies. And within these folders are other folders - for instance, in the "Audio" rescued folder, there are hundreds of AIFF files, AIFF1 files, AIFF2, MP3, WAV, m4a, and m4p files.
    My question is: can someone please tell me what the heck a Garage Band project file is? That would save me a lot of time in digging through all this material trying to find one....
    (Don't get me wrong... I'm grateful to have stuff to dig through! I just hope my Garage Band files are intact and recoverable.)
    Has anyone had success saving Garage Band files with Data Rescue II?
    Thanks in advance.

    Aaaagh!
    I spoke too soon. Yes,I did indeed find the file that contained all the files I needed to retrieve (using Disk Rescue II). When my 6-hour download of the 78 GB folder finished, I check the files again, and they weren't located in the orphaned section, but in the Hard Drive section under the normal directory, in a folder called .Trashes - within that there was another folder called "501", which contained all the Garageband files I needed to retrieve. However, when I tried to open the downloaded "rescued" files, they were inside a folder called "Macintosh HD", which could not be opened, and I got a message that said "Could not be opened because you do not have sufficient access privileges." Not only that, but even after 6 hours of (apparently) downloading the 78 GB folder, my hard drive, which had close to 83 GB of free space, said STILL had almost that same amount.
    So did it download anything or not? What was it doing all those 6 hours? I have a file that I can't open, but apparently it's going to be empty anyway.
    Here's the full story, for anyone with the patience to listen and offer advice. It looks like now I'm looking for a way to 1) get the permissions to open the .trashes file so that I can download everything, or 2) figure out a way to get Disk Rescue II to open the files and download them regardless of the permissions.
    Full Story -
    I am pretty sure that my computer crash was caused by working with the newest version of Garageband 08. Ever since buying it and loading it, my computer has been acting funny whenever I use the Garage Band program - I could only record about one in three attempts since the computer kept freezing as soon as I finished recording a line. I would have to use force restart to get going again.
    The day the computer crashed, I was working on a Garage Band project, which kept crashing, and I was also using Finale, Microsoft Word, and iTunes -- all of which are my normal procedure and I'd never had any problems with anything before loading the new Garage Band 08. (See my posts on other discussion topics for more details). After the last freeze, the computer crashed totally and could not be restarted - it would get to the gray screen with the spinning gear and just sit there while the fans ramped up to overload.
    I used Disk Warrior to rescue whatever files I could onto an external hard drive, and I started to download all the Garage Band files. However, the "estimated time to completion" said over 6 hours , so I stopped the download after a minute or so and went on to rescue all the other files that were smaller in size and easier to download - I figured I'd set Disk Warrior to download the whole 78 GB set of Garage Band files overnight while I slept. But....when I went back to begin the download again, I noticed that the directory of Garage Band files went only to the letter "C" instead of all the way to "Z" like my original files had done during that earlier attempt to download. I am assuming that somehow, the directory for the files I download before aborting the attempt (A-C) got exchanged with the directories of the original version (A-Z), but the original directory was no where to be found.
    I decided to try an archive install in the hopes that I could just restart my computer and get the files out by hand. The archive install went fine, and the computer started up fine and got to the log-in screen, which had changed. I now had two blanks - one for user name and one for password, instead of the choices of names. I tried all my user names and passwords, and asked my wife for her names and passcodes, but nothing worked. The computer had apparently re-set all its permissions and User accounts. I tried using Disk Utility to reset the password in its opening screens, but instead of getting several User options, the only one it allowed me to attempt was "System Administrator (root)", and even that wouldn't let me in to change any passwords.
    That's when I downloaded Data Rescue II, which does seem to do a good job of locating lost files. However, since I didn't have permissions to open the computer the last time, I am still apparently facing the same thing when I try to access files copies OFF the computer.
    So I'm not out of the woods yet. I can see the files on the Data Rescue screen, but I don't know whether they have permissions tied to them or not, and if they do, whether the system would let me since I don't know what the passwords and user names have defaulted back to.
    Any advice? Please?

  • Downloading .xls file with multiple rows and Columns

    Hi ALL,
    I need to genarate .xls file with multiple rows and and Columns and sent as an email.Since our customer having Problem with .CSV files need to genarate .XLS file.
    Please do the needful.
    Thanks
    Madhu

    Hi Madhu,
    You might also consider using Excel Spreadsheet XML as the target structure (namespace is urn:schemas-microsoft-com:office:spreadsheet).  When you double-click the resulting xml on a PC it automatically opens with Excel. So, users don't see a difference.  It will open up a lot of options with formatting including creating multiple worksheets if you wanted to.  Best of all you can stick with XML.
    See my response in this thread:
    Re: Convert XML data into XLS 
    Thanks,
    -Russ

  • Importing CD to Artist folder\Album folder\file with track number and name:

    I have a problem then importing my cd’s to my harddisk using iTunes.
    On my previous pc I got what I want, Artist folder, Album folder and file with track number and name:
    e.g.
    D:\My Music\B.B. King\Blues On The Bayou\01 Blues Boys Tune.mp3
    D:\My Music\B.B. King\Blues On The Bayou\02 Bad Case Of Love.mp3
    D:\My Music\B.B. King\Blues On The Bayou\03 I'll Survive.mp3
    But now I get:
    D:\My Music\Compilations\Blues On The Bayou\01 Blues Boys Tune.mp3
    D:\My Music\ Compilations \02 Bad Case Of Love.mp3
    D:\My Music\ Compilations \03 I'll Survive.mp3
    In iTunes my settings are Edit -> Preferences -> Advanced: iTunes Music folder: D:\My Music and checkmark in both: “Keep iTunes Music folder organized” and “Copy files to iTunes Music folder when adding to library”.
    My version of iTunes is 8.0.1.11
    Thanks in advance
    Peter

    It will depend on the album. Gracenote considers anthologies, a collection of tracks by the same artist taken from different albums, as a compilation. In iTunes the compliation setting should really only be applied to a collection of tracks by different artists.
    tt2

  • Problem with Date Picker and wwv_flow_item.date_popup()

    I have a Report based on the HTMLDB How-To “Build Tabular Forms for Multi-Row Operations”
    This is my code:
    select
    X.RRIT_UID,
    X.DOS,
    X.CPT_CODE,
    X.MOD,
    X.DX_CODE,
    X.CHARGES,
    X.UNITS
    from
    (select
    htmldb_item.text(1,RRIT_UID) RRIT_UID,
    wwv_flow_item.date_popup(2,null,RRIT_DATE_OF_SERVICE) DOS,
    htmldb_item.text(4,RRIT_SUBMIT_SERVICE_CODE,6) CPT_CODE,
    htmldb_item.text(5,RRIT_SUBMIT_MODIFIER,3) MOD,
    htmldb_item.text(6,RRIT_ATT_DIAG_CODE,6) DX_CODE,
    htmldb_item.text(7,RRIT_BILLED_CHARGES,9) CHARGES,
    htmldb_item.text(8,RRIT_UNITS,3) UNITS
    from
    RRIT_REPRICE_ITEM
    where
    RRRR_UID = :P5_RRRR_UID
    union all
    select
    htmldb_item.text(1,null) RRIT_UID,
    wwv_flow_item.date_popup(2,null,null) DOS,
    htmldb_item.text(4,null,6) CPT_CODE,
    htmldb_item.text(5,null,3) MOD,
    htmldb_item.text(6,null,6) DX_CODE,
    htmldb_item.text(7,null,9) CHARGES,
    htmldb_item.text(8,null,3) UNITS
    from
    dual)
    X
    My problem is when I run the page and select a date from the Pop-Up calendar I get this error:
    Line 10
    Error: ‘opener.document.forms.0.f02.0’ is null or not an object
    I know it is something to do with data formats and the fact that I do not fully understand the use of wwv_flow_item.date_popup().

    Hi DK,
    It is a WD Java application, Backend is ABAP (MM module).
    The UI is input field, where the context attribute type is Date, So its been changed to Date Picker.
    The problem is when the user runs the WD application in Portal, The calendar format is being changed for some users. That is for few users the Week starts with Monday and for few users the week starts with Sunday.
    I need all the users to have Monday as the First day of the week.
    Please let me know, what will be solution for this.
    Since I haven't done anything in regard to date, it is a simple Date format.
    Thanks & Regards,
    Palani

  • In Photoshop Elements 12, is there a way to batch process all photos in a file with 'Auto Tone' and save the changes?

    In Photoshop Elements 12, is there a way to batch process all photos in a file with 'Auto Tone' and save the changes?

    Thank you, that was perfect!
    Yoni

  • "File with specified name and version number already exists. Result code= -48."   ...????

    Recently I have been getting this error message when I try to record an audio track in Logic... "File with specified name and version number already exists. Result code = -48."  WHAT IS THE PROBLEM?????? It's making me furious!

    Hi
    As the message says, there is a file at the recording directory that has the same name:
    http://support.apple.com/kb/ht1618
    Try changing the name of the track (this sets the filename in later versions of Logic 9
    CCT

  • Ok.  I hope someone can answer my question.  I am new to photoshop.  I need version cs4 in order to work with a designer and printer on some logo work. I've tried to download it but it just gives me individual files with no installer and nothing - includi

    ok.  I hope someone can answer my question.  I am new to photoshop.  I need version cs4 in order to work with a designer and printer on some logo work. I've tried to download it but it just gives me individual files with no installer and nothing - including the adobe "instructions" seems to work.  How can i get this software in a downloadable format? is it actually free - I'm assuming it is...  Hope someone knows the answer to these questions...

    The download itself is free and is valid for 30 days only.  After that, the software ceases to work.
    CS4 is pretty old, no longer sold and no longer supported by Adobe.  It's also not compatible with many modern OSes.
    Why do you have to work with such an obsolete version of Photoshop?
    What kind of "designer" uses it?

  • With 10.7.2 update iCal does not allow you to set "Reminders" by draging events from "All Day Events" into "Reminders" is there another way to do this instead of having to type out the entire reminder with date, time, and type?

    With 10.7.2 update iCal does not allow you to set "Reminders" by draging events from "All Day Events" into "Reminders" is there another way to do this instead of having to type out the entire reminder with date, time, and type?
    With Lion 10.7.1. you where able to drag events from "All Day Events" into the "Reminders" bar to create upcoming reminders.

    Exactly the same question I was about to post!
    Great being able to sync reminders (well overdue) however if I have to re-type a calener envent into reminders it's a waste of time!! 
    Come on Apple!!
    Just need an option for the calender event to add to reminder or the old drag to add to reminder functionality back, Please???

Maybe you are looking for

  • Default interest key determined in payment against security deposit

    Dear All, I am creating a request for security deposit by transaction FPSEC1. In that I have maintianed interest key as "03-Exemption of Interest on Security deposit" A statistical entry is getting posted in business partners account. After that I am

  • How to install output module

    I am trying to install the Output module with Adobe Bridge and I have followed the instructions on Adobe's site. However, the instructions say to install the files to path that is non-existent, to my current knowledge. For example: It's saying to ins

  • Non Privilege mode

    we are running XP and Windows 7 with user logged-in with local admin rights. Using Group Policy of Windows, you can run IE in non-privilege mode so that if the browser session is hijacked, can't impact O/S because IE is running with user level privil

  • Setting default variant in QA32

    Hi Everybody, When the user goes to transaction QA32, the plant and other values which were there in his variant are replaced by other values. Please let me know how can a user set a variant as default so that whenever he comes to transaction QA32, h

  • Change the number of history entries on the Back Button

    Firefox allows 15 history entries when holding the Back (or Previous) button. If I want to go to the #31 entry in the history, I have to press and hold Back many times to reach it. I want to change that number for more entries like 50. Is it possible