Create Directories based on File Names

I have a Folder with all of my digital photos. All of the photos are named using a %Y%m%d_%H%M%S.jpg format. I am trying to write a script that would go through, and create folders based on the %Y%m%d portion of the name. Then move the photos into the appropriate folders. Then, create folders named according to %Y%m of the newly created folders, and move the %Y%m%d folders into the %Y%m folders. So that my folders would be organized as /%Y%m/%Y%m%d/%Y%m%d_%H%M%S.jpg or 200809/20080905/20080905_083026 - for a photo taken today.
Any tips for getting started on this? As always, thanks in advance.

There are a number of ways of doing this, here's one model:
set topFolder to (choose folder with prompt "Please select the folder containing your images")
tell application "Finder"
  repeat with eachFile in (get files of folder topFolder)
    -- get the file name and date elements
    set filename to name of eachFile
    set YMD to characters 1 through ((offset of "_" in filename) - 1) of filename as text
    set YM to characters 1 through 6 of YMD as text
    -- make sure the subfolders exist. If they don't then create them
    if not (exists folder YM of topFolder) then
      make new folder at topFolder with properties {name:YM}
    end if
    if not (exists folder YMD of folder YM of folder topFolder) then
      make new folder at folder YM of folder topFolder with properties {name:YMD}
    end if
    -- now move the file
    move eachFile to folder YMD of folder YM of folder topFolder
  end repeat
end tell

Similar Messages

  • I want to create xml file using photoshop script and also i can easily add, modify, delete based on file name

    Hi,
    Please help me for this.
    I need to create XML file for mentioned below. when i run the photoshop script i need deatails for active document name, date, time and status.
    <?xml version="1.0" encoding="UTF-8"?>
    <sample>
    <filename>Cradboard_Boxes_Small.tif</filename>
    <date>today date</date>
    <starttime>now</starttime>
    <status>delivered</status>
    </sample>
    <sample>
    <filename>Cardboard_Boxes_Student_Vaue_Pack.jpg</filename>
    <date>today date</date>
    <starttime>now</starttime>
    <status>delivered</status>
    </sample>
    I need read that xml after creating and modify based on file name. i need to modify status after file finished.
    if the file name is already exist i want to modify or delete or add whatever i need.
    Kindly help me simple way

    You may want to look into getting Xtools ps-scripts - Browse Files at SourceForge.net then.  Most of the support is for ActionManager script code where XML code is use as an intermediate step.  There are quite a few Photoshop script in XTools .   Ross Huitt is an expert javascript programmer though is is fed up with Adobe's lack of support for Photoshop scripting particularly the bugs in ScriptUI he is still maintaining tool he  has created for us free of charge. Tools like Image Processor Pro. None of his scripts are save as binary so you can read all of his code there is a wealth of knowledge in there....
    Also there is a scripting forum Photoshop Scripting

  • Receiver File adapter: dynamic folder name based on file name

    Hi there,
    is it possible to set up one communication channel that will use different target folders based on file name?
    E.g.
    File abcdef will be saved to /root/abcdef/abcdef or /root/abcdef/abcdef.txt
    File xyz will go to /root/xyz/xyz or /root/xyz/xyz.txt
    I know I could use Sender/Receiver Service, Interface/namespace or data from message for variable substitution but could not find an easier solution for this scenario than to create multiple communication channels.
    Thanks.

    If you haven't a message mapping, then you can create only an interface mapping with an abap mapping.
    In your abap mapping:
      DATA l_record type mpp_dynamic.
      l_record-namespace = 'http://sap.com/xi/XI/System/File'.
      l_record-name = 'FileName'.
      l_record-value = "your filename"
      dynamic_configuration->add_record( l_record ).
      l_record-namespace = 'http://sap.com/xi/XI/System/File'.
      l_record-name = 'Directory'.
      l_record-value = "your directory ".
      dynamic_configuration->add_record( l_record ).
    Afther that, you must activate Adapter Specific Message Attributes (directory and/or filename) in your target communication channel .
    Regards,
    Carme.

  • File Channel sequential processing based on file names

    Hi,
    I have a requirement in a sender file channel.
    There are mulitple files with different file names, I want these files to be processed in sequence based on the file name.
    For example.
    The files lets say are A3_1, A2, A1,A3_2.
    I want to process A1 then A2 and then A3.
    Please suggest methods to implement the same, I think an adapter module should help, please throw some light on the same.
    Regards,
    Varun.

    Varun,
    In that case I think you need to consider BPM. The file adapter does not support 'advanced' techniques for the sequence in which it polls files.
    The process would then be:
    - Use the adapter specific identiers for the file adapter to include the file name (/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions)
    - Create a message mapping that puts the file name from the dynamic configuration into a field in the message type
    - Create an integration process that receives the files from this adapter inside a loop step (/people/daniel.graversen/blog/2006/09/07/using-a-bpm-to-collect-messages-for-a-set-interval-of-time)
    - You can now create an interface mapping that sorts the messages according to their filename and then send the messages to the receiver one by one (EOIO?).
    Kind regards,
    Koen

  • Crearte folders based on file name and then do action

    I've written this in the best possible step to step way as possible buti've no idea how to pull it altogether as a script. Hopefully its all there, just let me know if its still not clear, I would love the help if anyone can help sort this out for me.
    Many Thanks
    Matt
    -there is a folder on the desktop called Season_SSxx_PSD where xx = a number
    --This folder contains a quantity of PSD files that need to be processed the same but placed in different locations.
    set theDesktopFolder to "Hal 9000:Users:matthew:Desktop"
    set folderName to (folder of theDesktopFolder whose name starts with "SE")
    --From the folderName
    --set the seasonNumber to the item that follows Season_ and is before _PSD (the Season number should be SS13  but can change)
    --Look at all files of folderName
    --Files can be named like the following.
    -- SE_BH70NW01234BM4BM
    -- SE_BU40NW01234BM4BM
    -- SE_ES20NW01234BM4BM
    -- SE_DV25NW01234BM4BM
    -- SE_DJ30NW01234BM4BM
    -- SE_RA30NW01234BM4BM
    -- SE_FR10NW01234BM4BM
    -- SE_TM15NW01234BM4BM
    -- SE_WA35NW01234BM4BM
    -- Now set the brandIdentifier to Item that follows SE_ of the file names of the folderName
    --Convert brandIdentifier to realName
    --BH = BigandHuge
    --BU = Buttons etc..
    -- Now create the folders
    --set up names to destination folders and create over Network for FTP collection (based on a mounted drive)
    --set this_ftp_folder to "Impulse:"
    --set ftpSeasonNumberFolder to my getFolderPath(seasonNumber, this_ftp_folder)
    --Or Impulse:SS13:
    --set ftpBrandFolder to my getFolderPath(realName, ftpSeasonNumberFolder)
    --Or Impulse:SS13:BigandHuge:
    --set ftpBrandFolder_High_Res to my getFolderPath(realName & seasonNumber & "_HR", ftpBrandFolder)
    --Or Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:
    --set ftpBrandFolder_High_PNG to my getFolderPath("_PNG", ftpBrandFolder_High_Res)
    --Or Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:PNG:
    --then the following
    --Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:JPG:
    --Impulse:SS13:BigandHuge:BigandHuge_SS13_LR:PNG:
    --Impulse:SS13:BigandHuge:BigandHuge_SS13_LR:JPG:
    --Its these last 4 that will be used later.
    --then all files begining with BH in the folderName  do this photoshop action and save in the folders created from --above, then move on to the next file begining with BU create the relevant folders and then do the action as --before and so on.

    Cool that sorted the folder creation out without an issue, many thanks.
    Just struggling to pin the photoshop part in.
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    -- empty log file
    do shell script "echo  'Files not processed in Photoshop :'  > ~/Desktop/LogPhotoshopError.txt"
    set noError to true
    --at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
    --use the result for the if file exists?
    display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
    set skipFiles to (button returned of the result) is "Skip (Faster)"
    set theDesktopFolder to "Hal 9000:Users:matthew:Desktop"
    tell application "Finder" to set seFolder to (folders of folder theDesktopFolder whose name starts with "SE")
    if seFolder is not {} then
              set seFolder to item 1 of seFolder
              tell application "Finder" to set tName to name of seFolder
              set seasonNumber to my getText(tName) -- get Season Number
              if seasonNumber is not "" then
                        set list1 to {"BH", "BU", "ES", "DV", "DJ", "RA", "FR", "TM", "WA"}
                        set list2 to {"BHS", "Burtons", "DaisyAndEve", "Diva", "DorothyPerkins", "DorothyPerkins", "Freedom", "TopMan", "Wallis"} -- you must complete this list ***
                        set tc to count list2
                        repeat with i from 1 to tc
                                  set brandIdentifier1 to item i of list1
                                  set brandIdentifier to item i of list2 -- the real name
      --first item = all files begining with BH
                                  tell application "Finder" to set theseFiles to (files of seFolder whose name starts with "SE_" & brandIdentifier1) as alias list
                                  if theseFiles is not {} then
      --local Folders
                                            set this_local_folder to "Images:2012-2013"
                                            set localSeasonNumberFolder to my getFolderPath("SS" & seasonNumber, this_local_folder)
                                            set localSeasonFolder to my getFolderPath(brandIdentifier, localSeasonNumberFolder)
                                            set localSeasondFolder_PSD to my getFolderPath("PSD", localSeasonFolder)
      --  *** Now create the folders ***
                                            set this_ftp_folder to "Impulse:"
                                            set ftpSeasonNumberFolder to my getFolderPath("SS" & seasonNumber, this_ftp_folder)
                                            set ftpBrandFolder to my getFolderPath(brandIdentifier, ftpSeasonNumberFolder)
                                            set ftpBrandFolder_High_Res to my getFolderPath(brandIdentifier & "_SS" & seasonNumber & "_HR", ftpBrandFolder)
                                            set ftpBrandFolder_Low_Res to my getFolderPath(brandIdentifier & "_SS" & seasonNumber & "_LR", ftpBrandFolder)
      --Use the folders below within Photoshop
                                            set ftpBrandFolder_High_PNG to my getFolderPath("PNG", ftpBrandFolder_High_Res)
                                            set ftpBrandFolder_Low_PNG to my getFolderPath("PNG", ftpBrandFolder_Low_Res)
                                            set ftpBrandFolder_High_JPG to my getFolderPath("JPG", ftpBrandFolder_High_Res)
                                            set ftpBrandFolder_Low_JPG to my getFolderPath("JPG", ftpBrandFolder_Low_Res)
      --- *** end create the folders ***
                                            repeat with i in theseFiles
                                                      set tFile to i as string
      --taking the folder identify which process it must follow.
                        if brandIdentifier is equal to "BHS" then
                                  try
                                            tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                                  on error
                                            set o's theseNames to {} -- no psd files or "8BPS"
                                  end try
                                  set numOfNames to (count o's theseNames)
                                  repeat with j from 1 to numOfNames
                                            set thefile to theFolder & ":" & (item j of o's theseNames)
                                            --    B H S    Folder Photoshop Process
                                            set thisName to (item j of o's theseNames)
                                            tell application "Finder"
                                                      set t_ext to name extension of file thefile
                                                      if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                                      set b to exists file (localSeasondFolder_PSD & thisName & ".psd")
                                            end tell
                                            if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                                      tell application "Adobe Photoshop CS5.1"
                                                                -- I remove the command activate, Photoshop stay in background
                                                                set ruler units of settings to pixel units
                                                                try
                                                                          open (alias thefile) showing dialogs never
                                                                          set origName to name of current document
                                                                          set myOptions to {class:JPEG save options, quality:12}
                                                                          set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                          tell current document
                                                                                    --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                                    if (quick mask mode) then delete channel ¬
                                                                                              "Quick Mask"
                                                                                    --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                                    if (exists layer "Original Layer") then ¬
                                                                                              tell layer "Original Layer" to set name to "Original Image"
                                                                                    save in (localSeasondFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                                    (delete layer "Original Image") flatten
                                                                                    resize image resolution 300 resample method none
                                                                                    --sharpen image
                                                                                    filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                                                                                    save in (ftpBrandFolder_High_JPG & name) as JPEG with options myOptions without copying
                                                                                    --Prepare for Low RES by resetting image history
                                                                                    set current history state to history state 3
                                                                                    flatten
                                                                                    resize image width 1348
                                                                                    resize image resolution 300 resample method none
                                                                                    filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                                                                                    --add save to lowResFolder with same options
                                                                                    save in (ftpBrandFolder_Low_JPG & name) as JPEG with options myOptions without copying
                                                                                    close saving no
                                                                          end tell
                                                                on error
                                                                          set noError to false
                                                                          my myLogs(thefile) -- write path to log file in Desktop
                                                                          try
                                                                                    close saving no --if exists, close current document
                                                                          end try
                                                                end try
                                                      end tell
                                            end if
                                  end repeat
                                  --End BHS
                                            --taking the folder identify which process it must follow. W A L L I S
                        else if brandIdentifier is equal to "Wallis" then
                                  try
                                            tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                                  on error
                                            set o's theseNames to {} -- no psd files or "8BPS"
                                  end try
                                  set numOfNames to (count o's theseNames)
                                  repeat with j from 1 to numOfNames
                                            set thefile to theFolder & ":" & (item j of o's theseNames)
                                            --    W A L L I S     Folder Photoshop Process
                                            set thisName to (item j of o's theseNames)
                                            tell application "Finder"
                                                      set t_ext to name extension of file thefile
                                                      if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                                      set b to exists file (localSeasondFolder_PSD & thisName & ".psd")
                                            end tell
                                            if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                                      tell application "Adobe Photoshop CS5.1"
                                                                -- I remove the command activate, Photoshop stay in background
                                                                set ruler units of settings to pixel units
                                                                try
                                                                          open (alias thefile) showing dialogs never
                                                                          set origName to name of current document
                                                                          set myOptions to {class:JPEG save options, quality:12}
                                                                          set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                          tell current document
                                                                                    --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                                    if (quick mask mode) then delete channel ¬
                                                                                              "Quick Mask"
                                                                                    --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                                    if (exists layer "Original Layer") then ¬
                                                                                              tell layer "Original Layer" to set name to "Original Image"
                                                                                    save in (localSeasondFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                                    (delete layer "Original Image") flatten
                                                                                    resize image resolution 300 resample method none
                                                                                    --sharpen image
                                                                                    filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                                                                                    save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
                                                                                    --Prepare for Low RES by resetting image history
                                                                                    set current history state to history state 3
                                                                                    flatten
                                                                                    resize image width 1020
                                                                                    resize image resolution 300 resample method none
                                                                                    filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                                                                                    --add save to lowResFolder with same options
                                                                                    save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                                        close saving no
                                                                          end tell
                                                                on error
                                                                          set noError to false
                                                                          my myLogs(thefile) -- write path to log file in Desktop
                                                                          try
                                                                                    close saving no --if exists, close current document
                                                                          end try
                                                                end try
                                                      end tell
                                            end if
                                  end repeat
                                  --End W A L L
                          end if
    end if
    if not noError then do shell script "/usr/bin/open  ~/Desktop/LogPhotoshopError.txt'"
    on myLogs(t)
              try
                        do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
              end try
    end myLogs
    on getText(t)
              set {oTID, text item delimiters} to {text item delimiters, "_"}
              try
                        set r to ""
                        set r to text -2 thru -1 of (text item -2 of t)
              end try
              set text item delimiters to oTID
              return r
    end getText
    on getFolderPath(tName, folderPath)
              tell application "Finder" to tell folder folderPath
                        if not (exists folder tName) then
                                  return (make new folder at it with properties {name:tName}) as string
                        else
                                  return (folder tName) as string
                        end if
              end tell
    end getFolderPath

  • Sanitizing an input to create a valid output file name

    I have a function that creates an ACL permission table X levels deep given a root folder and how many levels you'd like to go. I want to name the output file based on the root folder given, but obviously file names can't have certain characters in them.
    How do I replace all "< > : " / \ | ? *" characters with
    underscores? 
    [email protected]

    If anyone cares, here's my final code:
    Function Get-FoldersToDepth {
    Param(
    [String]$Path = $PWD,
    [String]$Filter = "*",
    [Byte]$ToDepth = 255,
    [Byte]$CurrentDepth = 0,
    [Switch]$DebugMode
    $CurrentDepth++
    If ($DebugMode) { $DebugPreference = "Continue" }
    Get-ChildItem -Directory $Path | %{
    $_ | ?{ $_.Name -Like $Filter }
    If ($_.PsIsContainer) {
    If ($CurrentDepth -le $ToDepth) {
    # Callback to this function
    Get-FoldersToDepth -Path $_.FullName -Filter $Filter `
    -ToDepth $ToDepth -CurrentDepth $CurrentDepth
    } Else {
    Write-Debug $("Skipping GCI for Folder: $($_.FullName) " + `
    "(Why: Current depth $CurrentDepth vs limit depth $ToDepth)")
    $date = get-date -UFormat "%d.%m.%Y"
    $a = "<style>"
    $a = $a + "BODY{background-color: #F0F0F0;}"
    $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: #D0D0D0;border-collapse: collapse;padding: 2px}"
    $a = $a + "TH{border-width: 1px;padding: 2px;border-style: solid;border-color: #D0D0D0;background-color: #BFFFFF}"
    $a = $a + "TD{border-width: 1px;padding: 2px;border-style: solid;border-color: #D0D0D0;background-color: #BFBFBF}"
    $a = $a + "</style>"
    Function CreatePermissionMap {
    Param(
    [string]$Path = $PWD,
    [string]$filter = "*",
    [Byte]$ToDepth = 255
    $folderprep = get-folderstodepth -path $path -ToDepth $ToDepth -filter $filter
    $folders = $folderprep.fullname
    $output = $path -replace '[<>:"/\\|?*]','_'
    ForEach ($folder in $folders)
    get-accesscontrolentry -InputObject $folder | select path, principal, AceType, AccessMaskDisplay, AppliesTo | ConvertTo-Html -Head $a -body "<H2>ACL entries for: $folder</H2>" | out-file -Append h:\powershell\temp\$output.$date.html
    I'm likely to spend the next 2 hours figuring out how to make all those tables line up
    [email protected]

  • SSIS - creating part of the file name from an id in the database

    I am trying to figure out how to pull an "id" from my data source to include in the file name. Right now the file name created looks like customer_002_timestamp.txt. I need to add the id to the file name and I need to grab it at the time I get
    the data, so then the file name becomes customer_002_id_timestamp.txt.
    My data source is Oracle and I am using Attunity, so I do not have the capability of using the resultset found in the SQL Task because I have to use the data task.
    Has anyone ever extracted an id from a query against Oracle using the Attunity connector to add as part of the file name? If so, how would I add that to my control flow task?
    Thanks in advance for any assistance.

    Is it a static id value you want
    Then you can just use a SSIS variable to hold value from resultset in execute sql task
    Then inside your data flow you can use an expression for setting value of another variable which can be used for setting filename in your destination task. The expression will include logic to concatenate id variable also which we populated in the previous
    step.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • BPM - merge files based on file name

    Hi All,
    i need to collect two source files based on the file name in BPM and then process it.
    Lets say, i need to collect a header file and a items file. but any point of time, there can be more than one header and more than one item file in the source folder. and i need to collect the header and its corresponding/related item file.
    can anyone help me how to achieve it in BPM? whats the correlation i need to give? is it possible to have a java code executed in BPM?
    Is it possible to take care of this at adapter level itself while picking the file? if so, whats the file name scheme can i give?
    Faster reply is very much appreciated.
    Thanks n regards,
    Rashmi

    hi,
    we can have the header file as header and item file as item. basically based on our convenient we can suggest the file name to the sender. so scheme can be anything that fits our requirement

  • Sql*loader - loading based on file name

    Hi,
    I am facing an issue with using sql*loader. I want to load two data files into one table. While loading the data I have to set a column value based on which file the loader uses. I will have to pass the data file name thru command line parameter.
    Can anyone give the code to do this?
    Data File names:
    sproc01.dat
    mproc01.dat
    sproc02.dat
    mproc02.dat, etc.
    One control file:
    load_data.ctl
    The control file should look like....
    load data
    append
    into a
    when substr(<file_name>,1,5) = 'mproc'
    data1 position(01:20),
    data2 constant 'M'
    into a
    when substr(<file_name>,1,5) = 'sproc'
    data1 position(01:20),
    data2 constant 'S'
    my doubt is, how to get the <file_name> in the when clause.

    Hi
    Depending on your server write a shell script or batch file to generate the control file.
    rgds

  • Trying to move a file based on file name

    ok, so i feel like this should be an easy thing to accomplish, but sadly, i can't seem to get it. here's what i got...i have an automator app that will take a file that has been scanned in (pdf) and rename it to the name in a field in one of my filemaker databases. got that working. now, depending on the name of the file, i need this applescript to move that file to the correct folder. for instance...if the file name starts with "P", then i need it to move to 'folder 1'. if it starts with 'L", it needs to move to 'folder 2'....and so on. this is what i've got, but it doesn't work. can someone point me in the right direction?
    on run {input, parameters}
    set FileName to input as text
    tell application "Finder"
    if name of FileName starts with "P" then
    move file FileName to folder "Drive:Folder:Folder1"
    else if name of FileName starts with "8" then
    move file FileName to folder "Drive:Folder:Folder2"
    else if name of FileName starts with "L" then
    move file FileName to folder "Drive:Folder:Folder3"
    else if name of FileName starts with "T" then
    move file FileName to folder "Drive:Folder:Folder4"
    end if
    end tell
    return input
    end run

    try...
    if character 1 of FileName is "P"
    edit:
    Whoops rereading your code I realized I completely misdiagnosed the problem there as "begins with" is proper applescript. What are you passing in as Filename? Try a "display dialog FileName" near the beginning of your script and see what you get. You might also try ...if fileName contains "string"...so you don't need to worry about starts with etc.

  • Deleting Applications based on file names.

    I have a pink palm centro, and I would like to delete the following applications: get email, sprint store, and sprint TV.  When I try to delete these things, it only gives me the file names on the list, and I don't know which file name belongs to what applications.. Can anyone help?
    Post relates to: Palm i705

    Hi..  Welcome to the Palm forums.  The applications you are trying to delete are all part of the rom and not removable.
    Post relates to: Centro (Sprint)

  • Create Folder according to file names

    Hello, I've been trying to do something "I thought" would have been very simple to do with Automator but with no success so far.
    Work required: I have a single folder (let's call it Root) that contains a lot of files (note there are only files, no subfolders under Root). I want to make a workflow that will create a separate folder within Root based on each file's filename and the respective files will be moved into this folder (note just the filename, no extension.)
    Example: Say I have 2 files in Root right now - ABC.zip and XYZ.avi. After I run Root through the workflow, 2 folders will be created within Root, called ABC and XYZ, containing ABC.zip and XYZ in each folder, respectively. There will be no more files within Root but subfolders.
    I tried a few times but not sure how I can get the filename of each file and create a folder accordingly. Thanks for the help!!

    Yes, It works like a charm.
    Still, I have some questions how to alterate.
    I have a library of movies that I unfortunately have in this way:
    ABC
         Adulthood.avi
         Adulthood.jpg
         Apocalypto.avi
         Apocalypto.jpg
    When I start the script it runs perfect until it comes to Adulthood.jpg and can not go on because the folder with that name already excist.
    I would like to change the script so that it goes through all files with a certaing extension and moves all files with the same name (no matter what extension it has)
    Does anyone know how to do this change in the script?
    The best thing would be to be able to write something like this:
    (file extension: .avi;mpg;mpeg;mkv etc)
    /Anders

  • Creating folders based on file creation date

    Hi,
    I have a folder full of images and I am looking for an Automator workflow/app/script that can look at the files sequentially, read the creation date and then create folder name based on the file creation date (Year-Day-Month). Then move the file to the respective folder.
    Appreciate any input you can provide.
    Regards
    Tom Erik

    Open the AppleScript Editor in the /Applications/Utilities/ folder and run:
    tell application "Finder"
    repeat with this_file in (get files of window 1)
    set the_date to creation date of this_file
    set folder_name to ((year of the_date as string) & "-" & day of the_date & "-" & month of the_date)
    try
    make new folder in window 1 with properties {name:folder_name}
    end try
    move this_file to folder folder_name
    end repeat
    end tell
    (75533)

  • Creating GUI based Help File!!!

    Can anyone point me to a resource where I can find information for creating Help for a GUI based application? I know that javadoc can create API specification for standalone programs but I like something for GUI based application like the one found on MS Word under Help menu.
    Need help plz.
    --DM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If anyone is trying to find out how DM777 implemented help. I would guess that he found JavaHelp.
    Here's a search to get you started
    http://onesearch.sun.com/search/developers/index.jsp?and=javahelp&nh=10&phr=&qt=&not=&field=&since=&col=javadoc&col=javatecharticles&col=javatutorials&col=devarchive&col=devall&rf=0&Search.x=0&Search.y=0

  • Advise on complex scenario. Correlation based on file name

    I need to process all *.xml files in a folder, but I should only process a specific .xml file if I find another one .ctl with the same name.
    That is. I may have 3 .xml files in a folder (a.xml, b.xml and c.xml), but as I have only one .ctl in the same folder (b.ctl), I should only process b.xml and do something with it.
    I've been struggling to find out a possible way to solve this scenario. I think it's only possible using NFS with the option of "additional files", but I have to use FTP, and it doesn't have that option.
    Of course I could implement it using a java module adapter in the sender comm channel for *.ctl files which establishes the ftp connection for the other file (.xml), but I'm trying to avoid this.
    Thanks!

    Hi,
    Hopefully this blog will solve your problem..(you have to set your parameter as per your need)
    /people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter
    Sorry Jorge, I misunderstood your question.. above blog will not help in your case..
    Update:-
    How about writing a script which will scan the source folder  and check if there is a file with .ctl extension then it will move the same name file with extension .xml into some other folder and then you can configure your adapter with this second directory path to simply pick the files.
    Edited by: Sarvesh Singh on Feb 12, 2010 2:07 AM

Maybe you are looking for