+ Post New Thread
Results 1 to 4 of 4
Coding Thread, Script to copy file if accessed today in Coding and Web Development; I volunteer at a local hospital radio station Our mp3 library is now too large I want a script I ...
  1. #1

    Join Date
    Apr 2008
    Location
    Notts
    Posts
    55
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    14

    Script to copy file if accessed today

    I volunteer at a local hospital radio station

    Our mp3 library is now too large

    I want a script I can run as a scheduled task to copy to another folder any tracks played today

    - so building a library of tracks that are used

    any ideas?

  2. #2

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    One of the NTFS file properties is last accessed date - you could check that and if it's in the last 24 hours then copy the file to another location.

    the downside with this is that *any* access to the file (even listing its properties in Explorer) triggers an update (so if you open a folder to see what files are there and have it in the details view where it shows the file info then all the files there are flagged as accessed)

    Also, the last accessed date is not updated on Vista/Windows 7 by default (I'd guess because the info is not as useful as it might be) - you can turn it back on (fsutil behavior set disablelastaccess 0 at a command prompt)

  3. #3

    AngryTechnician's Avatar
    Join Date
    Oct 2008
    Posts
    3,730
    Thank Post
    698
    Thanked 1,212 Times in 761 Posts
    Rep Power
    395
    In combination with the above:

    Code:
    robocopy /e /maxlad:1 c:\sourcefolder c:\destfolder

    Robocopy is included from Vista onwards, for XP you can download it as part of the Windows Server 2003 Resource Kit Tools

  4. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    Alternatively, do you use iTunes to play the music (or could you?) the library contains the last played date for every file. It's an XML file so you could hack the data out of it fairly easily but there's also an iTunes API.

    There is an API for Windows Media Player but I've never found it easy to use (ie I've never actually managed to do anything worthwhile with it!)

SHARE:
+ Post New Thread

Similar Threads

  1. File copy script
    By Quackers in forum Scripts
    Replies: 2
    Last Post: 21st August 2010, 10:20 AM
  2. Replies: 2
    Last Post: 3rd March 2009, 11:37 AM
  3. Replies: 4
    Last Post: 25th December 2006, 09:15 PM
  4. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  5. Replies: 3
    Last Post: 1st March 2006, 12:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •