Automatically keep 2 most recent files?

hi, i have a folder that i keep synced and that i access remotely.  however, i would like to find a way to always keep the most 2 recent added files in t hat folder... how could i do that? with automator? or applescript? im not too familiar with apple script. (not at all actually)
im looking for something a bit like dropbox where that folder would be monitored all the time and as soon as it senses that a new file was just added, it would delete the oldest by keeping always the most recent 2....
any ideas?
thanks... (running most recent version of mountain lion)

Hello, to get you started, Watched Folder...
http://www.mactech.com/articles/mactech/Vol.20/20.07/FolderWatching/index.html
http://hintsforums.macworld.com/archive/index.php/t-9652.html

Similar Messages

  • Let Photoshop automatically load the most recent file

    I have in the task bar icons for the PostScript editor PSAlter and for Photoshop.
    The workflow is always: Edit in PSAlter and interpret in Photoshop.
    Clicking in the task bar on the Photoshop icon should open Photoshop, load
    the most recent file (which is meanwhile modified), confirm last settings by OK
    and start the execution.
    Is it possible to automate this sequence – by just one click on the icon?
    Best regards --Gernot Hoffmann

    I doubt that would work out well.
    One could possibly link a Script to Photoshop being "brought to the foreground" with Script Events Manager but that might not always be the intended process when switching to Photoshop.
    How exactly is the "most recent file" identifiable?
    Do you change the settings often or could they stay fixed?
    Maybe you should also ask over at
    Photoshop Scripting

  • How can I stop apps from automatically opening the most recent file?

    Why do apps running under OSX insist on loading the last-opened file whenever you start them up?
    I've seen this now with Preview and QuickTime so far and it's really annoying. If I double click a file to preview or play it, why would I want the last files I'd viewed to also reopen without my asking for it?
    Really annoying...

    To switch off the "Restore windows ..." generally is the "brute force method".
    With some apps, this behavior is really a benefit (e.g. Terminal, Texteditors, ...).
    So you might decide to selectively switch off this behavior for each app, that should not restore:
    see link:
    http://www.macworld.com/article/161330/2011/07/four_lion_terminal_hacks.html
    e.g. for Preview:
    defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
    I guess this will soon be available as an option in each apps GUI-preferences.

  • Finding most recent file in a directory

    Hi,
    Is there a simple and easy way in labview to write a program that goes
    into a directory and looks for the most recent file. I can think of one
    way where I use the list directory vi to obtain an array of the file
    names in the directory and then use the file/directory info vi to
    obtain a time stamp for each file in the directory and afterwards sort
    all the time stamps. I'm not sure if this is the simplest way to do
    this, and wanted to ask if anyone on the discussion forums knows of any.
    Thank you

    unclebump wrote:
    Try here. http://zone.ni.com/devzone/cda/epd/p/id/3175
    This example is not that great and a few tweaks can greatly improve it!
    Building the path with string operations inside the loop automatically breaks this VI on anything but windows. There is a reason we have the "build path" function! It should always be used. The "string to path" and "path to string" should only be used for OS specific tasks.
    You probably want to skip files that are actually links. Newer versions of "File/Directory info" tell you if the path points to a link instead of a file with a boolean output.
    WIy do we need to keep an array of all files and maintain the corret index in a shift register. It seems more intuitive and less wasteful to just keep the newest file path in the shift register and not worry about the index.
    The image below shows a quick attempt at improving the example. Modify as needed.
    Message Edited by altenbach on 04-12-2007 02:45 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    find_newest_real_file.png ‏9 KB

  • Cannot see most recent files when attaching

    I've had this problem for a while. Currently using OS X Mavericks, 10.9.4 (latest version) and Mail 7.3 (also latest build).  Saved a file to Documents, then opened Mail and attempted to attach it. Finder window opens, but my most recent files viewed are "last 7 days," with "today" being completely missing. I can open the Finder independently, the files show, I can open the files, send the file as an attachment from the Finder itself. But for quite some time, I don't see my most recent files (like today's files) in Finder when first opening Mail and attempting to attach something from a new message or message reply. Very frustrating.
    Anyone know what's going on here? I've experienced this before, but this is the first I realized that it seems as if it only happens when I am searching for a file to attach, and not when I open the Finder directly. I know there are workarounds, but I would just like to be able to do this simple thing, and for the life of me, I cannot do it. Not sure how long this has been going on, but I think it was happening in Mavericks all along, I just didn't connect the dots.
    Thanks.

    I can't duplicate the issue. What type of file is it? Is it saved locally, in the cloud, external drive?

  • When I sort by date added in Column View in Finder, how can I make the most recent files appear at the top of the list?(Mavericks)

    In 10.8, when I sorted Finder by date added or date created in column view, the most recent files would appear at the top of the list. Currently, this happens as it should in every single view mode EXCEPT column view (which is pretty much the only view I ever use). Currently, I have a folder with over 2000 files in it that date back to 2011, so now I have to scroll for like ten minutes just te get to files that were most recently added. Who in their right mind would want to sort by last modified with the oldest result listed FIRST? Ridiculous. I can't figure this out. Any help?

    Thanks for the reply leroydouglas! Unfurtunately this doesn't cause the column to be ordered correctly either. After selecting this option, the files seem to be ordered by label, and the most recently added file is somewhere in the middle of the list. I'd like it to be at the top, and have other files/folders descend in retrochronological order by their add date.
    Any other input from the community would be greatly appreciated, even if it's just confirming that this is/is not expected behavior. I'd be super bummed to find out that this IS expected behavior, as it's really counterintuitive and extremely inconvenient.
    Thanks again!

  • I can no longer manually select podcast episodes to download. It automatically downloads the most recent. I have been downloading a few episodes at a time due to the limited memory of my Shuffle. Is there a work-around?

    I can no longer manually select podcast episodes to download. It automatically downloads the most recent. I have been downloading a few past episodes at a time due to limited memory of my Shuffle. Is there a work-around for this?

    Similar problem here. My Ical refuses to edit or delete events. Viewing is possible, though sometimes the whole screen turns grey. Adding new events from mail is still possible. The task-pane completely disappeared. My local apple technic-centre messed about with disk utility for a bit and than told me to reinstall leopard. I could of course do that, but it seems to me that reinstalling Leopard just to fix iCal events is a bit invasive.
    I tried also tried removing everything, installing a new copy of iCal from the leopard-cd, software updates, all to no avail.
    At the moment I'm open to all suggestions that do not include a complete leopard reinstall.

  • Not Showing Most Recent Files

    I've got a strange one. I've been able to network my imac to a dell laptop and they can see each other's shared directories. Tried to access an Excel file from the laptop and it didn't show the most recent file, but one that was nearly three weeks old. Is the imac caching the files anywhere? I didn't see any windows settings. Still getting used to the Mac world and didn't see any ability to refresh. Any ideas would be appreciated. Thanks in advance.

    Any pattern? Are they the most recently created or modified? Anything in common about how they are named, or in the +dot plus three+ extensions? Are you still seeing the older version of files on the Mac compared to directly in Windows.
    I've not used Windows 7 so I'm not familiar with any sharing filters that are possible. If you are still seeing older versions of files, and the ones you don't see on the Mac happen to be the most recently added to the folder, it still feels to me like you are actually connecting to a different sharepoint than what you believe... maybe one that is in an backup archive or something.
    Sorry I can't be any more helpful. It's a bit mysterious.

  • Email Most Recent File From Directory

    I am using C# to open a Spreadsheet, change 3 things in the spreadsheet, then save the spreadsheet in a directory, then open the directory.  I was trying to use FileSystemWatcher to capture the most recent file in the directory, but it seems that the
    Watch() event is being triggered before my syntax is able to make the changes and save.
    Is their a better method for this or do I just need to add in a Thread.Sleep() event so that the Watch() event triggers after the save is complete?

    Hi Indigo,
    >>I was trying to use FileSystemWatcher to capture the most recent file in the directory,
    but it seems that the Watch() event is being triggered before my syntax is able to make the changes and save.
    I have tested your code on my side, I supposed that you can add one button, when you
    change and save xls file successfully, try to trigger Watch() event by manual.
    I changed a little code with yours.
    Watch for changes in LastAccess and LastWrite times, and  the renaming of files or directories.
    Add all event handlers.
    Use messageBox to show something instead
    Here is my test reslut:
     Do I miss something? If so, please feel free to post here.
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    filewatcher();
    private void filewatcher()
    using (Process pRun = new Process())
    pRun.StartInfo.FileName = "D:\\Test\\test.xlsx";
    pRun.StartInfo.UseShellExecute = true;
    pRun.Start();
    string openPath = "D:\\Test\\";
    Process pRC = new Process();
    pRC.StartInfo.FileName = openPath;
    pRC.Start();
    private void Watch()
    FileSystemWatcher watcher = new FileSystemWatcher();
    watcher.Path = "D:\\Test";
    watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
    | NotifyFilters.FileName | NotifyFilters.DirectoryName;
    watcher.Filter = "*.xlsx";
    // Add event handlers.
    watcher.Changed += new FileSystemEventHandler(OnChanged);
    watcher.Created += new FileSystemEventHandler(OnChanged);
    watcher.Deleted += new FileSystemEventHandler(OnChanged);
    watcher.EnableRaisingEvents = true;
    private void OnChanged(object source, FileSystemEventArgs e)
    WatcherChangeTypes changeTypes = e.ChangeType;
    String filename = e.Name.ToString();
    MessageBox.Show("Hello");
    private void button1_Click(object sender, EventArgs e)
    Watch();
    MessageBox.Show("DOne");
    //private void sendMail(string filename)
    // using (MailMessage mail = new MailMessage())
    // mail.From = new MailAddress("");
    // mail.To.Add("");
    // string fileDirectory = path;
    // string fileFullPath = Path.Combine(filesDirectory, filename);
    // if (!File.Exists(fileFullPath))
    // return;
    // using (var xlsx1 = new Attachment(fileFullPath))
    // mail.Subject = "Test";
    // mail.Attachments.Add(xlsx1);
    // SmtpClient client = new SmtpClient("SMTP.MAIL.COM");
    // client.Send(mail);
    Best Regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Remove the duplicate rows but keep the most recent and oldest records

    I have a Product table, some products have duplicate rows(same productID). I want to keep the most recent and the oldest records based on ETL load date (or min and max productKey), delete others. How to do this in a simple way?
    ProductKey | ProductID |ETL_Load_Date
    1001 | 501 | 2014-01-01
    1002 | 501 | 2014-01-02
    1003 | 501 | 2014-01-03
    1011 | 502 | 2014-01-01
    1012 | 502 | 2014-01-02
    1013 | 502 | 2014-01-03

    declare @table table (ProductKey int, ProductID int, ETL_Load_Date date)
    insert @table (ProductKey, ProductID, ETL_Load_Date)
    values
    ( 1001 , 501 , '2014-01-01' ), ( 1002 , 501 , '2014-01-02' ),
    ( 1003 , 501 , '2014-01-03' ), ( 1011 , 502 , '2014-01-01' ),
    ( 1012 , 502 , '2014-01-02' ), ( 1013 , 502 , '2014-01-03' )
    SELECT *
    FROM @table t
    INNER JOIN (
    SELECT MIN(etl_load_date) min_load_date, MAX(etl_load_date) max_load_date, ProductID
    FROM @table
    GROUP BY ProductID
    ) m
    ON t.ProductID = m.ProductID
    AND t.ETL_Load_Date IN (min_load_date,max_load_date)
    This will show both the min and max load dates, for each ProductID
    Thanks to Saeid for posting some test objects.

  • Keep "2 most recent" not working in podcasts

    when i set iTunes to limit a podcast to limit a podcast to the 2 most recent why does it keep every podcast and not delete any ???

    Hello, to get you started, Watched Folder...
    http://www.mactech.com/articles/mactech/Vol.20/20.07/FolderWatching/index.html
    http://hintsforums.macworld.com/archive/index.php/t-9652.html

  • Retain 7 most recent files, delete all others

    How can I have a workflow delete all files within a folder, except the 7 files which were created most recently?
    Thanks,
    b.

    This isn't easily done with the creation date, but with the modification date, try using the following AppleScript action:
    tell application "Finder"
    set the_path to quoted form of POSIX path of (folder of window 1 as alias)
    set the_string to (do shell script ("ls -t " & the_path))
    set delete_items to paragraphs 8 thru -1 of the_string
    repeat with this_item in delete_items
    delete item this_item of window 1
    end repeat
    end tell
    This script operates on the frontmost Finder window.
    (25045)

  • Find the most recent file

    greetings,
    I am developing a web site in which we need to extract the 1st paragraph of the most recent press release and post it as content in a separate page. The press releases are all in their own separate files that get dynamically included into a templates page.
    I am able to open the file, get the text, set it to a variable and post to the separate page without a problem. What I need to know is how to know which file to open and read.
    I can use the lastModified() method to compare one file agains another, which I suppose would work fine it it was only a handful of files I Was comparing, but this could potentially be a pretty large number of files.
    Can anyone think of a relatively efficient way to do this? Are there any array sorting methods that may help here?
    Thanks,
    -d

    If you're looking to sort your File array by lastModified() date, then use the Arrays.sort() method with the following header...
    Arrays.sort(Object[] a, Comparator c)
    You can easily define the Comparator to sort by the date (either ascending or descending) and voila, you can quickly and easily find the most recent.

  • Full restore from Time Machine - how do I get most recent files back???

    Hi all,
    I've had some major problems with my hard-disk today (Disk Utility complaining about all sorts of things and not being able to repair them) so I thought I'll just wipe my disk and restore from back-up.
    But: when I was asked to choose a backup the most recent one was from 7th November. It said that only full backups are shown (and incremental backups are not shown...). Well, since I had no choice anymore, I selected the most recent one and hoped I could get things back again later. But I'm now struggling to find a decent way of doing this:
    All the more recent versions are on the time machine disk - I can see the files in the different folders. But in Time Machine itself, I cannot select any of the back-ups from between 7th November and now - they are shown to exist, but they are greyed out.
    Is there any way to return to my most recent state other than restoring the whole thing one-by-one from dozens of different folders?
    Any help would be greatly appreciated
    Thanks in advance!
    Sebastian

    Sebastian Hoffmann wrote:
    But: when I was asked to choose a backup the most recent one was from 7th November. It said that only full backups are shown (and incremental backups are not shown...).
    No, incomplete backups are not shown, including backups that failed, were cancelled, or were made with System files excluded. Other than that, all TM backups are, in effect, full ones.
    All the more recent versions are on the time machine disk - I can see the files in the different folders. But in Time Machine itself, I cannot select any of the back-ups from between 7th November and now - they are shown to exist, but they are greyed out.
    Is there any way to return to my most recent state other than restoring the whole thing one-by-one from dozens of different folders?
    Could you have renamed your internal HD on or about November 7? That's one possible explanation for what you're seeing. If so, TM would treat it as a separate disk: there would have been two disks listed in the pop-up menu above the list of available backups (item e. in the green box in #14 of the Frequently Asked Questions *User Tip* at the top of this forum).
    If that's a possibility, boot up from your SL Install disc again, and go through the process that far. If you find two disk names listed there, select the other one and see what dates are available. If you find your recent backups, do the restore again from one of them.
    If not, reboot normally, then try the +*Browse . . .+* Option, per #17 in the Frequently Asked Questions *User Tip* at the top of this forum.
    Restore what you need from the latest backup you can find that way. That will get the most recent version of everything. You can't restore your home folder that way, but you can restore each sub-folder and it's contents that way.

  • How can I modify Finder to actually find my most recent files?

    The more I use Finder the more I realize it's pretty crappy. The "recent files" folder never actually shows any files. And when I create my own recent files saved search, it's hit or miss as to whether it actually shows my recent files. All I'm trying to do is have an easy way to find files I've just modified or created, which should be really simple! Please help.

    Finder > View > Arrange By > Date Modified
    Shortcut is control-command-5

Maybe you are looking for

  • Is there a way to turn off the URL suggestions in Safari 5.1.3?

    I am a freelance video producer,  and I am trying to take video screen shots for a tutorial. However, when I begin typing anything in for a URL, Safari lists not only freqents sites I visit, but also my current history. I have tried using "private bo

  • Error in PO smartform Urgent pls.......

    Hi Experts, What is the cause for following error and what is the solution Points will be awarded... Invalid parameter for status request Message no. SSFCOMPOSER034 Diagnosis A document is to be output by fax (Smart Forms or SAPscript). However, the

  • Adobe Reader/Acrobat and Screen Readers, 50 page default?

    The company I work for creates large print PDF for our customers.  A lot of these documents are larger than 50 pages.  Is there a reason that the default setting for reading PDF's is set to 50 pages?  Is there a way that adobe can change this setting

  • Create PCD folder via API

    How can i create a new folder in pcd via java APIs?? Regards

  • Changing default program to open a file with Regedit

    Hi  Is there a way to change the default program to open a file with another program using a Rededit key. I would like to change the program to open a .g3pp file with vlc instead of media player cause it doesn't read it. Thanks