10 Replies Latest reply on Jul 16, 2013 3:54 AM by coherentkris

    Get names of files in a folder and saved date

    Tom_Droz

      I am using the free plugin BaseElement from Goya that allows me to capture all the names of files in a folder.

       

      Is there a way to also capture the saved date of those files?

       

      Any ideas are appreciated

       

      thanks

      Tom

        • 1. Re: Get names of files in a folder and saved date
          BowdenData

          Have a look at the Troi File plugin. It can do this and much more. <br/><br/>http://troi.com/software/fileplugin.html<br/><br/>Doug<br/><br/>Sent from my iPad

          • 2. Re: Get names of files in a folder and saved date
            Tom_Droz

            Thanks Bowden, I was looking for a free solution as this problem is rather minor...

            • 3. Re: Get names of files in a folder and saved date
              wimdecorte

              You can use OS level scripting to do it.  What OS are you on?

              • 4. Re: Get names of files in a folder and saved date
                taylorsharpe

                If you have Base Elements plugin, use the following example.  I have a file on my Desktop called "AirMac.pdf".  Using this command in the Mac OS will give the result below:

                 

                Command:

                                    BE_ExecuteSystemCommand ( "ls -l /Users/taylorsharpe/Desktop/AirMac.pdf" )

                 

                Result:

                                    -rw-r--r--@ 1 taylorsharpe  staff  247868 Feb  4 09:59 /Users/taylorsharpe/Desktop/AirMac.pdf

                 

                You'll have to text manipulate to grab the date.  But basically this function will do anything you can do from the Terminal in the Mac OS X (or in CMD for Windows).  Just know your command line and you'll be able to get what you want. 

                1 of 1 people found this helpful
                • 5. Re: Get names of files in a folder and saved date
                  s

                  Tom_Droz wrote:

                   

                  I am using the free plugin BaseElement from Goya that allows me to capture all the names of files in a folder.

                   

                  Is there a way to also capture the saved date of those files?

                   

                   

                  As Taylor suggested, you can use the BaseElement command BE_ExecuteSystemCommand to execute terminal commands. You can do the same thing without the plugin on a Mac by using Perform Applescript and do shell script.

                   

                  I would suggest using the "stat" (short for status) command instead of "ls -l" because the format of the results are more consistent. Specifically, ls gives different columns for files/directories that were modified in previous years:

                  -rw-r--r--@  1 steve  staff       1386 Feb 15  2012 test.csv

                  -rw-r--r--@  1 steve  staff     104641 Dec 14  2011 features.png

                  -rw-r--r--   1 steve  staff      17445 Jan 29 14:31 packets.png

                   

                  stat operates on one file at a time (so you would have to loop through your records), and returns data which looks like this:

                  16777218 1600565 -rw-r--r-- 1 steve staff 0 1386 "Jan 14 08:13:15 2013" "Feb 15 10:22:03 2012" "Feb 15 10:22:03 2012" "Feb 15 10:21:55 2012" 4096 8 0 /Users/steve/Documents/test.csv

                   

                  In either case, you will need to parse the results of the command to extract the date modified.

                   

                  HTH

                  --

                  Steve Moore

                  Cumberland, Maine

                  1 of 1 people found this helpful
                  • 6. Re: Get names of files in a folder and saved date
                    Tom_Droz

                    Thanks Taylor

                    I am not that familiar with the command lines in windows.  I am also unclear as what the script step is that run this line.

                    Any clarification is appreciated

                     

                    Tom

                    • 7. Re: Get names of files in a folder and saved date
                      wimdecorte

                      In a command window type in

                       

                      dir /?

                       

                      to see all the options for the command that is equivalent to the "ls" command on OSX

                      • 8. Re: Get names of files in a folder and saved date
                        Tom_Droz

                        Thanks for your thoughts and suggestions everyone.  It turns out this can be done with the free plugin Scriptmaster from 360works!

                         

                        Tom

                        • 9. Re: Get names of files in a folder and saved date
                          taylorsharpe

                          Great that you found a solution with ScriptMaster.  I really like ScriptMaster and it has some nice free functions that come ready to install.  The only dislike I have is that you have to load these functions to make use of them and it doesn't really load all that fast.  In fact, it is really slow.  For this reason I have been using BaseElements when a solution needs free and BE can do what is needed.  There are some things Scriptmaster and BE do that each other doesn't do.  However, I find now that I purchased the MonkeyBread Software plugin, I'm using it most of the time since it has so many functions and they execute very quickly. 

                           

                          The solution in Monkeybread Software would be "MBS ( "Files.CreationDate" ; path ). 

                           

                          I tried like a dickens to get BE to execute the command function on a Windows XP computer, but never could get it to work.  I was trying:

                           

                          BE_ExecuteSystemCommand ( "cmd.exe c/ dir c:\filename.txt" ; 500 )

                           

                          But it didn't work and would only return a 0.  I wonder if it would work in something newer like Vista, 7 or 8 or if I have the syntax wrong.  I didn't have any problem using the Mac OS X terminal commands, but I just couldn't figure the Windows ones out.  Oh well. 

                          • 10. Re: Get names of files in a folder and saved date
                            coherentkris

                            Google code used to have (may still have) a utility called xml-dir-listing that works great for this type of thing. It can be triggered via command line or os scripting.