Readingout date and create a folder

Hi,
I'd like to use automator to do the following:
reading out the creationdate of the raw-files in a folder ->creating folders that are named with the date of the files -> move the raw-files to the created folders.
How can I do that?
Thanks for hints and tips!

The following AppleScript action will take Finder items as it's input (for example, from Ask for FInder Items + Get Folder Contents), make new folders (as needed) named with the item creation date, and move the items into the appropriate folders:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters} -- move files
make new folders from file creation dates (if needed), then move document files into the folders
input: a list of Finder items (aliases) to move
output: a list of the Finder items (aliases) moved
set output to {}
set SkippedItems to {} -- this will be a list of skipped items
tell application "Finder" to repeat with AnItem in the input -- step through each item in the input
set {class:TheClass, container:TheContainer} to (get properties of AnItem)
if TheClass is document file then try -- just documents
do shell script "mdls -name kMDItemContentCreationDate " & quoted form of POSIX path of AnItem
tell (words of the result) to set TheDate to item 3 & "-" & item 4 & "-" & item 5
try -- check if the target folder exists
get ("" & TheContainer & TheDate) as alias
on error -- make a new folder
make new folder at TheContainer with properties {name:TheDate}
end try
move AnItem to the result
set the end of output to (result as alias) -- the new file aliases
on error -- permissions, etc
set the end of SkippedItems to (TheName & TheExtension) as text
end try
end repeat
if SkippedItems is not {} then -- handle skipped items
set TheCount to (count SkippedItems) as text
choose from list SkippedItems with title "Error with moving files" with prompt "The following " & TheCount & " items were skipped:" with empty selection allowed
if result is false then error number -128 -- user cancelled
set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set SkippedItems to SkippedItems as text
set AppleScript's text item delimiters to TempTID
display alert "Error with moving files" message "The following " & TheCount & " items were skipped:" & return & SkippedItems alternate button "Cancel" default button "OK"
if button returned of the result is "Cancel" then error number -128
end if
return the output -- pass the result(s) to the next action
end run
</pre>
I've tested it with a few items, but it is always a good idea to test with smaller batches before turning it loose on a lot of files.
HTH

Similar Messages

  • When saving an image, for example on Facebook, Firefox saves 20 random images too and creates a folder. Is there a way to prevent this?

    I try to save an image on Facebook, or other websites also and instead of saving that one image, Firefox saves multiple images and creates a folder called PHOTO.PHP-FILES for each image that I try to save.

    Hello,
    I think you are looking for this:
    https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file

  • ITunes update removes quicklaunch icons and creates new folder each time

    Everytime I install an iTunes update, it removes my quicklaunch icon and creates a new start menu folder.  I keep the iTunes start menu folder in a 'Media' subfolder (to keep things organized), but each time I update iTunes on each of my computers it creates a new iTunes folder in the main start menu. Any way to make it stop doing this? Since I work on multiple machines, it can be really irritating to have to redo icons and move folders each time.
    Working on PCs (Dell work laptops) running Windows 7.
    Thanks!

    Unfortunately it won't go into disk mode. Even tried the "put your ipod on a flat surface" trick. I'm wondering if the battery hasn't stopped holding a charge. But it seems the symptoms would be more like a constant battery icon. Instead I'm getting the sad face everytime I try to put it in disk mode or reset. Ideas? Throw ipod against wall? Blow on it like old-school Nintendo cartridges?
    Oh, and yes, it is Windows formatted.
    Any and all help would be appreciated.

  • How to get (old)previous date and create a loop?

    Hi!!!
    I am using java.util.date object.
    I need to get the 2 months back date,i.e. 60 days back date and to create a loop from that date till today and add it to combobox.
    Suppose today's date=3-12-2001
    x=date-60=3-10-2001
    and wants to create a loop from 3-10-2001 till today to display it in a combobox.
    Please tell me how can I do it?

    try the below which will print the date form 60 days before(from today) to todays date
    import java.util.Calendar;
    import java.util.Date;
    public class RandomNumber
         public static void main(String args[])
              RandomNumber rn = new RandomNumber();
              rn.printDate();
         public void printDate()
              Date todayDate = new Date(System.currentTimeMillis());
              Calendar calendar_ = Calendar.getInstance();
              calendar_.setTime(todayDate);
              calendar_.add(Calendar.DAY_OF_YEAR, -60);
              for(int i=0;i<60;i++)
                   System.out.println(calendar_.getTime());
                   calendar_.add(Calendar.DAY_OF_YEAR, 1);

  • Difference between document date, posting date and created on date in FI

    hi
    Would like to know in which scenario can the document date be different from posting date in case of incoming payment which reamains unallocated for a while.
    Please correct my understanding : created on date will be the date on which we enter/create in SAP which can be different in case we are uploading the documents from legacy sys.
    But will it be different from posting and document date in case this document was created in SAP itself.
    Thanks and regards,
    Sarah.

    Hi
    Document date and creation date are same ie date on which document is created but the posting date is the date on which the document is posted lets say for example a document is created on friday 5:55 as the office gets closed at 6 and sat sun is off now the posting date will be date on monday or the date after monday when the document gets all the necessary approvals
    so it can be posible that posting date and creation date are same for a document and vice versa is also true
    thanks
    puneet

  • How to update data and create notification no using isr fm.

    Hi,
    Without creating the scenario in SFP, is it possible to update data directly in ISR_SPECIAL_DATA_SET,
    i want to use fm ISR_SPECIAL_DATA_GET in my program.
    i'm trying to achive same using ISR_NOTIFICATION_CREATE and built general, special table and long text to get a
    notification number. but  notification no is not creating ,  return msg is  ( E I 421   |Notification type  not defined ) even i'm passing currect notif type.                            
    Regards
    Ali

    Hi vijay,
    Nice to see your reply, I think, you are right...
    The Fm ISR_SPECIAL_DATA_GET already used in my various reports, Workflows etc.
    And I have a custom WebDynpro java based application which have similar data and have custom notification no. + (in this case probably i need to create new fm ZISR_SPECIAL_DATA_GET to use in above report and wf)+
    To avoid the rework and minimized the code Iu2019m trying to create notification no using standard fm and link custom WD data with ISR_SPECIAL_DATA_GET.
    Please let me know how to proceed with that
    Regards
    Raza

  • Difference between Data and Create data

    Hi ,
    Can any one please tell me the difference between CREATE DATA and DATA statement.
    What all situations we need to use the create data statement.
    Thanks in advance.
    Joe

    Hi,
    here is a quote from ABAP documentation.
    Unlike the DATA statement, CREATE DATA creates the data object at execution time. DATA creates declared data objects when the corresponding program unit is loaded.
    More info can be found in ABAP documentation. CREATE DATA is usually used in dynamic programming where you work with generic types.
    Cheers

  • Trackpad mouse moving on its own and creating new folder on desktop

    This stared a few weeksd ago, I've lost control of my macbook pro as my mouse has a mind of its own.
    The laptop barely(or even not at all) responds to my control.  It's like there was somebody else controlling my mouse, my keyboard works fine however.  The guy hacking me looked at my mailbox, dropped a few things from the dock, made a new folder on the desktop and opened my photos.  I've tried everything including  turning off wi-if, my reuter and under "system preferences" unclicked "sharing" of anything. I also took it to the genius bar to have my laptop wiped and updated to OS X Mountain Lion.
    Last week, my mouse again started to move on its own and created a new folder on my destop.
    I don't know if anyone has the same experience...and if so, please let me know what is going on and is there a solution?
    Thank you

    Woah, I just got this really sketchy email a few hours later. It's a bounce back from an invalid address, but it includes the previous few messages too... these guys are definitely speaking in some sort of code.
    I pasted it on this google doc for your inspection, pretty crazy. Do you think it could be related to this cursor moving incident? Did I get remotely hacked or something?
    https://docs.google.com/document/d/1NlP_g-skisehtH-kEMKPvYjDL5hrhyGPBcCpS_L4_AI/ edit?hl=en_US

  • AppleScript Mail, Compare Date and Move to Folder

    tell (current date) to set dateForm to (its weekday as string) & (its month as string) & " " & day & ", " & year
    --set dateForm to "Tuesday, March 6, 2012" -- for testing on your Sample Email for Script, remove this line to  matches current date
    -- formats the current date like "Tuesday, February 29, 2012"
    tell application "Mail" to set emailsSource to messages of mailbox "Good Tuesday" of account "HappyGoLucky45"
    repeat with anEmail in emailsSource
              tell application "Mail" to set theSource to source of anEmail
              set tLines to paragraphs of theSource
              set tc to (count tLines)
              if tc > 165 then
                        set foundDate to false
                        repeat with i from 120 to 190
                                  if getDate(item i of tLines) then
                                            set foundDate to true
                                            exit repeat
                                  end if
                        end repeat
                        if foundDate then
                                  set theMailbox to "zOld"
                                  tell application "Mail"
                                            move the anEmail to mailbox theMailbox of account "HappyGoLucky45"
                                  end tell
                        end if
              end if
    end repeat
    on getDate(theText)
              set k to 0
              repeat with thisWord in words of theText
                        set k to k + 1
                        if thisWord is in ¬
                                  {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} then
                                  try
                                            if (exists word (k + 1) of theText as integer) ¬
                                                      and (exists word (k + 2) of theText as integer) then
                                                      set theFoundDate to word k of theText & " " & ¬
                                                                word (k + 1) of theText & ", " & ¬
                                                                word (k + 2) of theText
                                                      if date theFoundDate < (date dateForm) then return true
                                            end if
                                  end try
                        end if
              end repeat
              return false
    end getDate
    --Below is how the email appears and the Date I am trying to compare to the Current Date (DateForm)
    --The format of the email has changed and I can't figure out how to fix it.
    --This is to move old messages to different folder
    --About this event
    --Tuesday, October 29, 2013 at 11:55 PM (EDT)

    Anyone have any thoughts?

  • Disabling JFileChooser's rename and create new folder options

    Thanx in advance.
    Can anybody guide me as to how to disable the following in JFileChooser :
    1. tool bar buttons where the user can create a new folder.
    2. Renaming a file
    regards,
    Vikas

    Ok, ok, here's the code. Again, don't use if you don't absolutely have to.
    Use at your own risk. This is just an example. No guarantees given. Etc, etc.
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.plaf.basic.*;
    public class ReadOnlyFileChooser extends JFileChooser {
        BasicFileChooserUI ui;
        public ReadOnlyFileChooser(String path) {
         super(path);
         if (System.getProperty("java.version").startsWith("1.4") &&
             getUI() instanceof BasicFileChooserUI) {
             ui = (BasicFileChooserUI)getUI();
             // Disable "New Folder" button
             ui.getNewFolderAction().setEnabled(false);
             addPropertyChangeListener(new PropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent ev) {
                  if (ev.getPropertyName() == JFileChooser.DIRECTORY_CHANGED_PROPERTY) {
                   SwingUtilities.invokeLater(new Runnable() {
                       public void run() {
                        ui.getNewFolderAction().setEnabled(false);
             String className = ui.getClass().getName();
             if (className.equals("javax.swing.plaf.metal.MetalFileChooserUI") ||
              className.equals("com.sun.java.swing.plaf.windows.WindowsFileChooserUI")) {
              // Disable editing (file renaming) in JList
              JList list = (JList)findByClass(this, JList.class);
              MouseListener[] listeners = list.getMouseListeners();
              for (int i = 0; i < listeners.length; i++) {
                  className = listeners.getClass().getName();
              if (className.endsWith("FileChooserUI$SingleClickListener")) {
                   list.removeMouseListener(listeners[i]);
                   break;
              // Disable editing (file renaming) in JTable
              JToggleButton detailsViewButton = findDetailsViewButton(this);
              detailsViewButton.addActionListener(new ActionListener() {
              boolean done = false;
              public void actionPerformed(ActionEvent ev) {
                   if (!done && ((JToggleButton)ev.getSource()).isSelected()) {
                   SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                        JTable table =
                             (JTable)findByClass(ReadOnlyFileChooser.this,
                                       JTable.class);
                        if (table != null) {
                             TableColumn column =
                             table.getColumnModel().getColumn(0);
                             column.setCellEditor(null);
                   done = true;
    private static Component findByClass(Component comp, Class cls) {
         if (cls.isInstance(comp)) {
         return comp;
         } else if (comp instanceof Container) {
         Component[] comps = ((Container)comp).getComponents();
         for (int i = 0; i < comps.length; i++) {
              Component c = findByClass(comps[i], cls);
              if (c != null) {
              return c;
         return null;
    private static JToggleButton findDetailsViewButton(Component comp) {
         Icon detailsViewIcon = UIManager.getIcon("FileChooser.detailsViewIcon");
         if (comp instanceof JToggleButton &&
         ((JToggleButton)comp).getIcon() == detailsViewIcon) {
         return (JToggleButton)comp;
         } else if (comp instanceof Container) {
         Component[] comps = ((Container)comp).getComponents();
         for (int i = 0; i < comps.length; i++) {
              JToggleButton button = findDetailsViewButton(comps[i]);
              if (button != null) {
              return button;
         return null;
    public static void main(String[] args) {
         new ReadOnlyFileChooser(null).showOpenDialog(null);
         System.exit(0);

  • SOS -- Exporting data and creating documents  -- SOS

    Hi all. I've a "little" problem!
    I'm implementing an application for a public administration and the users would like to create and print documents (official acts) either through a custom form or with a concurrent request. Furthermore these users prefer these docs in word and we dont know if it's possible (maybe we can try workin with .rtf format).
    The problem is that we dont know how to begin and what is the easiest way to do that.
    I hope that someone can help us!!
    Thx all!!
    Jaco

    Jaco - You didn't say what application you're implementing but since you're posting in an E Business Suite forum, I'll assume we're talking about Oracle 11i...
    11i has many seeded reports which can be customized through a variety of means. There's Oracle Reports which can be used to customize the seeded .rdf or create new rdfs.
    http://www.oracle.com/technology/products/reports/index.html
    Lots of 3rd party products exist to further customize the rdfs - Optio is one we use.
    http://www.optio.com/
    There's a product called XML Publisher which uses Word and Excel to customize documents. http://www.oracle.com/technology/products/applications/publishing/index.html
    -Tracy

  • WP 8.1 LiveSDK 5.5 get folder and create folder issue on some devices

    Hi,
    I've an app which will connect to the users OneDrive account and creates a folder and upload a textfile.
    1. I check if a specifig folder exists, and if it exists, I'll get the folder ID.
    LiveOperationResult operationResult = await client.GetAsync("me/skydrive/files?filter=folders");
    foreach (var item in operationResult.Result.Values.ToList())
    foreach (IDictionary<string, object> fo in (item as List<object>))
    if (fo["name"].ToString() == folderName)
    return fo["id"].ToString();
    If the ID is null, I'll create the folder with this piece of code...
    await client.PostAsync("me/skydrive", new Dictionary<string, object>() { { "name", "MyFolderName" } });
    My issue... this won't work on any windows phone device.
    This will work on my device Lumia 925 with WP 8.10.12393.890 one device where this won't work is a Lumia 830 with WP 8.10.14219.0
    I'll will get these error messages from some customers:
    "The resource couldn't be created because a resource named 'MyFolderName' already exists." or "Input parameter 'path' is invalid.  'path' must be a valid URI."
    So what could be my issue? Can anyone help me with this.
    In my develeopment environment I just updated to LiveSDK 5.6 and it will work on my Lumia 925 device. Could this a soloution for my issues? (It's not uploaded to the app store with this change).
    I'm greatful for any hint or solution.
    Kind regards
    Kevin

    Hey
    Thanks for reaching out to us on the community and welcome aboard. I hope you find all the answers you were hoping for (Though we're not sure of the meaning of life just yet) ;)
    In regards to your troubles, the best place to start would be with a clean reinstall of the app. It will make sure that any faulty cache data etc. will be removed. Find instructions on how to do so here:
    https://support.spotify.com/learn-more/faq/#!/article/reinstallation-of-spotify
    Of course, get back to me and let me know how it all goes. I'd love to help out should you need me more.
    Thanks! :)

  • Migrate from File Server Shared Drives to Document Libraries, while Keeping Modified and Created Date

    I am doing some file migration for a client, using SharePoint 2013 on prem.
    Whether copying files from a local or network drive, to a Document Library, or from Document Library to other Document Library, I want the option of
    preserving file dates and created/modified by fields.
    I am developing a pretty cool tool in Excel to analyze files and directory names for restricted characters, large file sizes, and long path names...and then
    it generates copy commands or rename commands as desired. I will share this with you if you like. This little glitch is the last remaining barrier.
    Can we copy and retain Modified/Created Data and time? Can I do this using xcopy or robocopy or do I need to use powershell, ShareGate, or some other tool?
    I have tried Windows Explorer drag-n-drop, "robocopy /COPY:DAT" and "xcopy /k"
    and these seem to work great in th CMD window until you display the resulting files in SharePoint...and the modified date shows as now and modified by
    shows as me.
    Any suggestions you can provide are most welcome.

    Hi Gerry,
    try content matrix it gives you free 25 GB and it keeps metadata
    http://www.metalogix.com/Products/Content-Matrix/Features.aspx
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation

  • How do I use a usb portable drive to let me add or move files and create folders

    I have a 256 gb porable smart drive  USB and need to move some files to another USB 1 TB drive and create a folder on the 1 TB drive for the data off of the smaller one.  When I try to create a folder and using finder it has the new folder grayed out.  using Info it tells me that I only have permission to read the drives but they both worked fine on the windows Laptop.  I guess I need to learn more about Finder.

    I guess you're trying to create the folder on the 1TB drive.
    Question: Are you OK initializing that drive on your Mac?
    If so, you can use Disk Utility (in Applications > Utilities) to do so.

  • Applescript: Create a Folder from Files of Same Name but different Extension

    Hi guys,
    Racking my brain for the past 2 hours trying to figure out how to properly use Applescript but alas to no avail.
    My  problem is as follows.
    xxxxxxx.extension1
    xxxxxxx.extension2
    yyyyyyy.extension1
    yyyyyyy.extension2
    zzzzzzz.extension1
    zzzzzzz.extension2
    I've been trying to create an applescript that takes files of same name and create a folder with the name of those files grabbed.
    So ultimately it would look like
    xxxxxxx/
         xxxxxxx.extension1
         xxxxxxx.extension2
    yyyyyyy/
         yyyyyyy.extension1
         yyyyyyy.extension2
    zzzzzzz/
         zzzzzzz.extension1
         zzzzzzz.extension2
    Can some more more adept at this than me provide with a solution?  It would be great if I could use by just selecting the folder that contains all these files.
    Also can anyone suggest an beginner's book on Applescript?  I'm a bit or an order freak and Im sure applescripting could help me automate a lot of repetitive tasks Im currently doing.
    Thanks!

    This will do what you need.
    set source to (((path to desktop folder) as text) & "Test") as alias
    tell application "System Events"
                   set fnames to (name of every file of source)
    end tell
    set AppleScript's text item delimiters to "."
    repeat with fname in fnames
              try
                   set folderName to text item 1 of fname
                   if folderName is not "" then
                    tell application "Finder"
                      if not (exists (folder folderName of source)) then
                          make new folder at source with properties {name:folderName}
                      end if
                     move file fname of folder source to folder folderName of source
                 end tell
           end if
        end try
    end repeat
    (the code formatting here really s*?ks. select all the text in the box and right click and select services make new AppleScript to get it into the editor)
    It's not very polished so be careful, setup some test folders and make sure it does what you want before using it on your live data.
    You need to set the
    set source to
    line to the path of the folder where the files are. You can do that as an absolute path ie "Macintosh HD:Users:etc" or using the path to as in the example.
    It is also not very efficient and there are many different ways to attack this problem. If this is a one time thing this will be fine. If it will be an ongoing situation you might want to describe exactly what is happening and other ways to solve the problem might be possible.
    As for learning AppleScript start with the Apple Development Site, especially AppleScript Language Guide.
    There are lots of sites out there with good info MacScripter being one of the better ones.
    Book wise I really like Learn AppleScript by Apress. Its good as both a tutorial and reference and has a good intro to AppleScript Objective-C (a way Apple ahs setup to allow AppleScripts to access pure objective-c code and the OS X GUI).
    good luck

Maybe you are looking for

  • Error while performing SSO with java application

    hi ALL , I got rhe following error when i call a java application in portal  using ticket logon sso Exception report message Internal Server Error description The server encountered an internal error (Internal Server Error) that prevented it from ful

  • Can you change the DEFAULT VIEW of a published iCal to MONTH VIEW?

    Can you change the DEFAULT VIEW of a published iCal to MONTH VIEW? I use this for a vacation rental and people never ever ever ever need to see anything but the MONTH VIEW. I hate having to tell them to click MONTH view at the top of the page. Is the

  • I have been trying for two weeks to back up iCloud. I keep getting a message failure. Why??

    I have been trying for two weeks to backup iCloud and keep getting a message failure. Why? And how do I fix it?

  • Before commit

    when does the before commit operation in ViewObjectImpl will invoke in ADF...Any one can give a sample code for using the same for inserting a value for a field in the ViewObject which is not displayed in JSP page kindly Reply Regards Anitha

  • Db_writer_processes and the location of the redo logfile

    Is any beneficiary relationship between the number of the DBWR and the location of the redo logfiles? i.e if I spread out the redo logfile to several disks, will that benefit system with multiple DBWR? My system is 10g r2 on AIX 5.3 L with 4 CPU and