Shell Script- download the latest CDR file created

I have a solaris (Solaris 10) based system, where CDRs (Call Detail Records) are generated and stored in a direcotry in xml format.
I use SFTP to download the CDRs created in the directory and backup in another server (again on Solaris 10).
Right now I do this with a shell script, where I download all the files from top to buttom stored in the directory (using *.xml). There are about 120 files created and will be downloaded eachtime.
I have automated this task by using a cronjob to run the script daily.
Now I want to take this a step further and download only the latest file created. Each file will have the date stamp as a part of the file name, and also the created date will be the current date.
Please help me on this.

why not ls -r | head -1 | awk '{ print $1 }' ?
That'll get the latest file.
Here's an example on one of my machines:
# ls -lr | pg
total 222
-r--------   1 root     sys          405 Jun 23  2006 sys_sar
-rw-rw-r--   1 root     root        3732 Feb  7  2005 README
drwxr-xr-x   2 root     root         512 Nov 13 13:17 installed
-rwxr-xr-x   1 root     root        9972 Feb 20  2003 ftpshut
drwxr-xr-x   2 root     root         512 Feb 19  2003 etc
-rw-r--r--   1 root     root       93884 Feb  8  2005 en_us_relnotes.pdf
drwxr-xr-x   2 root     sys          512 Mar 15  2007 crontabs
drwxrwxrwx   2 10490    smmsp        512 Jul 10  2002 adobe
# ls -r | head -1 | awk '{ print $1 }'
sys_sar
# Best,
Edited by: John.Kotches on Nov 13, 2007 1:19 PM
Edited by: John.Kotches on Nov 13, 2007 1:19 PM

Similar Messages

  • I am installing Itunes after a cpu restore and am getting this error reading "the file Itunes cannot be read because it was created by a newer version of itunes. I have downloaded the latest version and this is what i get when i try open the program

    Hi all, please help me reinstall Itunes onto my PC. When i did a pc refresh, it deleted my itunes and microsoft office. I am now trying to reinstall itunes and am getting the following message each time i try run the new downloaded version ( i have tried a few older and the latest one and all show the same message)
    the file Itunes cannot be read because it was created by a newer version of itunes. I have downloaded the latest version
    Cheers
    Andrew

    Tell us some version numbers please, of your Mac OS versions and iTunes versions on both computers (two eMacs yes?).
    dlrobinson49 wrote:
    I guess I must have had a newer version ofiTunes on my defunt eMac....
    That is a pretty good guess.Try updating the second eMac's iTunes to at least the version that was on the first.

  • TS1717 While downloading the latest iTunes version, my computer turned off. When I opened iTunes, it says that "The file "iTunes Library.itl"  cannot be read  because it was created by a newer version of iTunes" Help please :(

    While downloading the latest iTunes version, my computer turned off. When I opened iTunes, it says that "The file "iTunes Library.itl"  cannot be read  because it was created by a newer version of iTunes" Help please

    That message is usually a sign that you tried to roll back to an earlier build of iTunes, but occasionally I've seen it connected to a new upgrade. This technique should fix things.
    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

  • While importing and burning some CDs, my entire library has disappeared.  Also, there no longer is a "burn file to disc" command in the File menu.  I have downloaded the latest version of itunes which restored only tracks I bought from the iTunes store.

    Also, the "burn playlist to disc" command has disappeared from the File options.  I downloaded the latest version of iTunes but that only restored tracks I'd bought from the iTunes store.  I also tried setting up another logon.

    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping.  Note that in iTunes 11 an "empty" library may show your past purchases with links to stream or download them.
    In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    Alternatively, depending on exactly when and why the library went missing, there may be a more recent .tmp file in the main iTunes folder that can be copied & renamed as iTunes Library.itl to restore the library to an earlier state. Look for a recent .tmp file that is similar in size to the .itl files in the Previous iTunes Libraries folder. If it has happened repeatedly you may want the earliest such file generated since the last iTunes upgrade.
    If applicable, see iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device.
    I've noticed more of these missing library posts of late and a common factor to most since I started asking is AVG Anti-Virus. It seems in some cases it might be at least part of the reason why the library file disappears. Try excluding the iTunes folder from any AV scanning process.
    tt2

  • Since upgrading to Snow Leopard from V10.4.8 My copy of Open office won't load.  I've downloaded the latest version but it still responds with a "time out" message.  Anyone know waht's up and what I can do about it.  I can't even read my old files.

    Since upgrading the OS on my MacBook to Snow Leopard my open office suite has died.  All the old files are still on the HDD, but even "finding" them doesn't help as they are opened, unhelpfully, in Text Edit, which loses some of the formatting.  I tried downloading the latest edition of Open Office, but it has made no difference.  Any suggestions?  Apple OS support has no solution to offer.

    Found this, which might provide a clue:
    I have had problems with 3.1 after installing Snow Leopard, with files created in MS Word - they come up with the text invisible (as though it's white, but changing the text colour doesn't help - by highlighting I can tell that the paragraphs are where they should be).
    I upgraded to 3.1.1 but that did not solve the problem...
    UPDATE: I found out the problem, it was nothing to do with Open Office, but rather the way Snow Leopard handles fonts. I went into the Font Book and found that a number of common fonts are now listed both in the "User" and "Computer" collections. I deleted the duplicate ones from "User" and now all works perfectly.
    http://forum.openoffice.org/en/forum/viewtopic.php?f=5&t=22045
    (Scroll down)

  • I tried downloading the latest OS X Mountain Lion and [after a long time... I have a slow connection] I got an error message ... The product distribution file could not be verified. It may be damaged or was not signed.

    Hi folks,
    I tried downloading the latest OS X Mountain Lion and [after a long time... I have a slow connection] I got an error message ... We could not complete your purchase The product distribution file could not be verified. It may be damaged or was not signed.
    Everytime I retry or continue the download I just keep getting the same error message!!!
    What can I do to get my product?
    PM

    The only thing that worked for me was to boot in safe mode.
    Power down.  Then press power button and hold 'shift' key until grey screen with progress bar appears... Once booted and logged in just open safari and browse to applestore. 
    No trouble at all once I did this.
    Reminder: create full backup before you upgrade OS
    Hope it helps.

  • I tried to download the latest OSX Mountain Lion and got this notice - "We could not complete your purchase.  The product distribution file could not be verified.  It may be damaged or was not signed. "  What does this mean and why can't I download it?

    I tried to download the latest OSX for my iMac - Mountain Lion.
    This is the message that I received:
    "We could not complete your purchase.  The product distribution file could not be verified.  It may be damaged or was not signed."
    What does this mean?

    The only thing that worked for me was to boot in safe mode.
    Power down.  Then press power button and hold 'shift' key until grey screen with progress bar appears... Once booted and logged in just open safari and browse to applestore. 
    No trouble at all once I did this.
    Reminder: create full backup before you upgrade OS
    Hope it helps.

  • I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file re

    I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file readers as well, and for some reason they won't work either. I have 5 computers running top end processors and RAM. By this I mean I have one, this one which I am using that has an AMD Phenom Black 3.2 Quad-core with 8 GBs of Corsair top DDR2 RAM, my other two AMD have either an Athlon II triple core with 4 GBs of DDR2 Corsair RAM, one with the Phenom X4 965 3.4 GHz Quad-core with 8 GBs of their best DDR2 RAM, and two Intels with the i7 920 Processors using the triple channel 1366 socket processors and one with 8 GBs of low latency DDR3 RAM and the other with 4 GBs of the same RAM. I am getting the message on this one, which has a fresh install of XP Pro X64 operating system, as do the other 4 as well. I have run Avast Business Pro Anti-virus on this one, which I am getting the message on with a single result which I deleted, and also both Spybot Search and Destroy, which came back clean as well as Malwarebytes Antimalware, which got a lot of tracing cookies now removed, and SuperAntiSpware which also found a few cookies also now deleted. Can you tell me what I need to do to get these files to show as .pdf files rather than as a clean blank page. One other issue is that I wish to know how to turn off my downloads so they are saved and Mozilla will give me the option of returning them instead of me losing them all together as it does now. Thanks for your assistance. If there is another Adobe reader I should download and install, could you provide me with the link to it? I appreciate your assistance here
    == When I download and try to read a .pdf file and when I am asked to turn off all Firefox files and if I do, I lose them since I need to know how to save them without rebooting my computer.

    Brilliant! Problem solved! Thanks so much.

  • I have a canon 70d and just purchased elements 12. It will not open a raw file for me. I have been advised to download the latest version of camera raw, i have done this and it still says my camera is not supported. I really need to open my raw files. Can

    i have a canon 70d and just purchased elements 12. It will not open a raw file for me. I have been advised to download the latest version of camera raw, i have done this and it still says my camera is not supported. I really need to open my raw files. Can anybody help me.

    You'll need to update to at least ACR 8.2 for the 70D to be recognized.  The normal way to update PSE12 to the latest CR is to use Help / Updates in the Editor which should update to ACR 8.5.
    According to Adobe's website PSE12 shipped with ACR 8.1 and you say it says yours is reported as ACR 8.0.
    Are you using PSE 11 and not 12?  PSE 11's maximum ACR version is 8.0.

  • I have always been able to create playlists on itunes, then drag them to my ipod when it was plugged into the mac. I recently downloaded the latest version of itunes, and now I am unable to do that. I am able to drag songs and albums but not my playlists.

    I have always been able to create playlists on itunes, then drag them to my ipod when it is plugged into the mac. I recently downloaded the latest version of itunes, and now am unable to do that. I can drag songs and albums to the ipod, but not my playlists. It used to be so easy, am I missing something here?

    Plug your iPod into your computer, it will begin to sync. Now check to see if the playlists have been added.
    If not, go to the songs tab under your iPod when it is connected to iTunes, Unless you have checked "Sync all songs (or something to those words)" you should have an option on what you can put on your iPod. Make sure to check the playlists that you want on your iPod.

  • Can I force the bootcamp wizard to skip looking for the bootcamp drivers?  I have already downloaded the latest drivers and loaded them on a FAT usb drive.  All I want is for bootcamp to create the partition and allow me to install windows 8 pro

    Hi Everyone,
    Can I force the bootcamp wizard to skip looking for the bootcamp drivers?  I have already downloaded the latest drivers and loaded them on a FAT usb drive.  All I want is for bootcamp to create the partition and allow me to install windows 8 pro.
    The bootcamp drivers have been downloaded from apple's website.  Filename:  BootCamp5.0.5033
    I have a iMac 27" late 2013 model.
    NOTE:  I have downloaded the drivers manually from apples support site as the bootcamp wizard fails third of the way through the download.
    Appreciate any assistance.
    Regards,
    asdutoit

    There is a missing point in this thread, and it is that the Boot Camp drivers for the Late 2013 iMac can only be downloaded from Boot Camp Assistant. The Boot Camp drivers available in the Apple site are not compatible with that iMac.
    Delete the Boot Camp drivers from the USB drive, open Boot Camp Assistant and try to download the Boot Camp drivers again. If you get a message telling you that they could not be downloaded, I would try reinstalling OS X through OS X Recovery, by holding down Command and R keys while your Mac is starting up

  • I cannot download the latest update for itunes because it say the file itunes.msi is missing

    I cannot download the latest update for itunes because it says that the file itunes.msi is missing

    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • I tried to download the latest upgrade and got the following: "iTunes was not installed correctly. Please reinstall iTunes. Error 7 (Windows error 193).  Program Files/Common Files/Apple/Apple Application Support\ApplePushService.dll

    I tried to download the latest upgrade and I got a message telling me "The application or DLL ProgramFiles/CommonFiles/Apple/Applie Application Support\ApplePushService.dll is not a valid Windows image. Please check this against your installation diskette." and then below that another message "iTunes was no installed correctly. Please reinstall iTunes. Error 7 (Windows error 193).  I tried reinstalling and it still will not work.

    Taken at face value, you're having trouble with an Apple Application Support program file there. (Apple Application Support is where single copies of program files used by multiple different Apple programs are kept.)
    Let's try something relatively simple first. Restart the PC. If you're using Vista or 7,now head into your Uninstall a program control panel, select "Apple Application Support" and then click "Repair". If you're using XP,head into your Add or Remove Programs control panel, select "Apple Application Support", click "Change" and then click "Repair".
    If no joy after that, try the more rigorous uninstall/reinstall procedure from the following post. (If you've got XP, although the procedure is for Vista and 7, just read "Computer" as "My Computer", read "Uninstall a program control panel" as "Add or Remove programs control panel" and assume the system is 32-bit, and you'll be doing the right things.)
    Re: I recently updated to vista service pack 2 and I updated to itunes 10.2.1 and ever

  • HT204364 I'm creating a 'book' from an album in iPhoto.  I have downloaded the latest version.  However, I have selected a certain book i.e. wire bound, 19 page and when I'm creating it, it indicates 33 pages for one, and 42 pages for another.  How can I

    I'm creating a book from an album in iPhoto.  I have downloaded the latest version of iPhoto.  When I choose a book, i.e. wirebound, 19-20 page book, it shows a 42 page book when I am populating the pictures in the book I've selected.  Is that because I have more pictures in the album? 
    In any case, I can't seem to manipulate/choose the number of pages I want.  How can I stick with the 20 page book I want?
    Thanks.

    You can not select the "number of pages" - you select the photos and the page layours and the number of pages comes form that - with Autoflow iPhoto uses random page layouts so the number of pages is rando=m
    You can change layouts to include more photos, move photos to the pages with no empty photos frames and then delete the pages at the end after the photos are used elsewhere
    LN

  • I can't open the RAW files from my new Nikon D4s camera in photoshop? How do I download the latest software for RAW files?

    I can't open the RAW files from my new Nikon D4s camera in photoshop? How do I download the latest software for RAW files? Cheers!

    What version of Photoshop are you running?  You will need at CS5, CS6, CC or CC2014.  Each version needs a different ACR-plug-in to open files from that camera.
    If you are on CS4 or earlier, you'll need to upgrade—or, in the alternative; look for, download, instal, launch and run the free, stand-alone DNG Converter 8.6 on each file of raw NEF files to convert them to raw DNGs first so you can open them in your version of Photoshop and ACR plug-in higher than 2.4.

Maybe you are looking for

  • Network QoS and Server 2012 R2

    We are designing our new cluster environment on HP Blades with 6 Ethernet and 2 HBA connections: Ethernet  = 2 x on board and  4 x quad port HBA =  1 x Dual port I have been advised that we will be configuring Live Migration  on the Management networ

  • Install stand alone LR6 on second computer

    How do I install LR6 upgrade (stand alone) on a second computer?

  • Directory "domains" empty...

    I cannot run (Ctrl+F5) the projects I created in "Sun Java Studio Creator", because I do no have the "domain.xml" file. In fact the complete folder "domains" (*C:\Program Files\Sun\Creator2_1\SunAppServer8\domains*) is empty. I already reinstalled th

  • If I unplug my time capsule will I lose data?

    want to hide the time capsule before leaving home for a few days.  Hard to hide it when it's plugged in and running.   If I unplug it, do I lose data, and how difficult is it to start back up?

  • Is this a scam?

    I got an email that says I received an itunes gift card for $50. It seems pretty fishy to me, and takes me to this link http://webs-stor.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/ It was sent from the email address [email protected] I just want