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

Similar Messages

  • After i upgrade to mavericks, every time i create folder or delete files, they keep asking me ti fill the password, but only on my finder? help me please :) Thank You

    after i upgrade to mavericks, every time i create folder or delete files, they keep asking me ti fill the password, but only on my finder? help me please Thank You

    As a first step, open Disk Utility > select your hard drive > repair disk permissions.

  • Batch Folder renaming according to file name.

    Hi,
    I work in a busy photostudio and I am currently using automator to process thousands of Images, compression, size, name changes ect. However there is just one process I am stuck on. I need to put these Images into folders that relate to the file name. I have a process that will do this that I found here. This works well but i need it to only look at a certain part of the file name.
    For example if I had a collection of images like this,
    azz55412_blue_3.jpg
    azz55412_pink_2.jpg
    azz55412_blue_6.jpg
    azz78459_blue_1.jpg
    azz78459_blue_3.jpg
    azz65236_blue_7.jpg
    The current process would place each one in a folder named after each image. Ideally I would like it to only look at the first part of the name ie azz55412 and create a folder called that and place any other images it finds with the same code in that folder.
    Is this possible with automator or applescript?
    Any help or suggestions would be appreciated!
    Thanks,
    Mark

    Save the line below into a plain text file and give it the .jsx extension.
    app.activeDocument.activeLayer.name = decodeURI(app.activeDocument.name).match(/(.*)(\.[^\.]+)/)[1];
    Then create an action that runs that script. Then run File-Automate-Batch using that action.

  • 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

  • Create folder and move files to specific directory in AL11

    My requirement is to create a new folder in one of the existing directories in AL11 and move some files into it.
    I searched the forum and found this solution but it creates folder only in DIR_HOME directory.
    data: unixcom like rlgrap-filename.
    data: begin of tabl occurs 500,
    line(400),
    end of tabl.
    unixcom = 'mkdir mydir'. "command to create dir
    "to execute the unix command
    call 'SYSTEM' id 'COMMAND' field unixcom
    id 'TAB' field tabl[].
    I want the folder to be created in some other directory DIR_INTERFACES .
    Any suggestions are welcome ..

    Get complete path (physical path) using FM FILE_GET_NAME_USING_PATH.
    Default directory is DIR_HOME, hence it creates file in that directory...If you specify complete folder name, it will be created under that path..
    Concatenate mkdir
    space
    <physical path>
    mydir
    into unixcom.

  • Create folder (rename), move files and delete source

    This seems a simple and obvious need but I cant find anything to help.
    I want to be able to create a folder with a unique name (I would prefer to input the folder name when the workflow is run), move some files into it, and ensure the source files in the original location are deleted.
    The problem with the create new folder action as it stands is that it COPIES any files passed into it. I want to MOVE the files into a new folder.
    Am I missing something obvious?

    There's no out of the box way to achieve what you're looking for.
    Two solutions:
    1. Your users would need to open the entry first and then click on the "edit this file" link.
    2. You could code your own folder view or landing page element and build what you need.
    HTH
    Cheers
    Erik
    PS: Feel free to contact me offlist if you need professional support.

  • URGENT: Choosing target directory according to file name.

    Hi
    I have a requirement for transfering a file to the directory according to the filename.
    Example
    If the file name is
    FIABC it should be moved to directory DI_ABC in the target server and if it is
    FIXYZ it should be moved to directory DI_XYZ.
    No mapping is involved in this case .
    Do we have some other way around than variable substituion
    Regards
    Abhishek mahajan

    Hi,
    For this we have to configure Two Communication Channels one for one Location and the other for other location.
    Use X-path concept in Interface Determination and call the corresponding inbound Message Interface and Interface Mappings based on the condition
    1) Create Two Inbound MI's
    2) Create One MM
    3) Create 2 Interface Mappings
    4) Create 2 Receiver CC and One Sender CC
    5) Create One Receiver Det
    6) Create 2 Interface Det
    7) Create One Sender Agreement
    8) Create Two Receiver Agreements
    Regards
    Seshagiri

  • Creating Folder and Accessing Files from Folders in mobile phone

    Hello Friends,
    I am doing my project where I need to create folders and accessing files from those folders in java enabled mobile phones.But I do not know the required tasks for this.Any type of help is highly appreciated.
    Greeting
    Saadi

    You have to get the classname of the Items you receive from getitems.
    There you have only to look for Folder.CLASS_NAME. Example:
    ifsFol sorted by names in ascending order (names of folders and files)
    String[] sort_attributes = {"NAME"};
    //sort will be ascending
    boolean [] sort_orders = {true};
    oracle.ifs.common.SortSpecification sort = new oracle.ifs.common.SortSpecification(sort_attributes, sort_orders);
    ifsFol.setSortSpecification(sort);
    PublicObject[] contents = ifsFol.getItems();
    System.out.println("Here are the names of the items in folder: ");
    for (int i=0; i < contents.length; i++) {
    if (contents.getClassname().equals(Folder.CLASS_NAME)) {
    System.out.println(contents[i].getName());
    null

  • 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

  • Create folder with multiple files (was: folders)

    Can you create a folder with multiple files and direct the page to go to the folder and then the reader can select the file they wish to choose?  Example  Council Mintes Folder with a file for each set of minutes.  The hyperlink would open the folder and then the reader would select whch set of minutes they'd like to see.

    You may not have access to it depending on your hosting company and  plan, but if you did have the ability to change it you'd normally do it in the admin area of your hosting account which would update the proper files on your server.
    You may also be able to do it manually, but the "how to" depends on the server type you are running.
    EDIT: I'd still suggest using a server script (like the PHP I linked to) because the look of a directory with browsing turned on is pretty ugly and can't be changes since it's not a page on your site. With the PHP I linked to, you could have an actual page for your links, complete with your site's design, that simply lists the files from the specified directory. It's very simple to set up if you have PHP on your server.

  • Why do my video podcasts now save in a folder under the file name "download"  and not the name of the podcast

    I just downloaded Itunes 10. When I download video podcast they save in a individual folder with the podcasts name.tmp, then inside the folder is the video file just named DOWNLOAD. This didnt happen in the previous versions of itunes why is this happening in Itunes 10? How can I change so that the files save as the name of the podcast.

    Some users seem to be having issues with the latest build (10.2.2) where files are not moved/renamed after downloading. It works fine for me in a test library so I'm not quite sure what the issue is. You may find things sor themselves out if you turn off Keep iTunes Media folder organised and then turn it back agaqin (assuming you use that feature). Hopefully the next update isn't too far away.
    Alternatively you can try my script ConsolidateByMoving which should move selected files that are in the "wrong" place to their standard iTunes locations.
    tt2

  • How to automatically rename tracks according to file name

    Hi all,
    this is probabaly a very simple fix but for some reason its foxing me today,
    in CS6 when importing multiple audio files, is there a way of automatically naming the tracks the same as the file name.
    eg if the file is labeled 'snare.wav' and you import it into Track 1, then the track is then renamed 'snare'
    thanks.

    Thanks for the reply Steve, I understand the implications your refering to, I just wondered if there was an option to turn this on if required, so for instance if i am importing 70 or so audio files i dont have to go through and name each track one by one.
    something similar to the 'Use Audio File Name as Track Name' option in Logic would be useful.
    regards

  • Create folder view with files and tasks

    Good day to you,
    we want to support our software development procces with Vibe. What we are doing is, we make changes to the source code and protocol corresponding things in certain files.
    We think in so called "releases" and every release consists of tasks and a list of changes. This list is held in an excel file, so I would like to create a folder view, which consists of tasks and files.
    So far I could create a custom folder view with attachments at the top and a task list at the bottom, based on the task family.
    The problem is, the attachment view as a standard folder view does not allow colleborative editing of attached files. You can only view and download attached files, but not open them via Office addin. Therefore you can not lock or version files, which is mandatory for collaborative work.
    I would like to mix the file folder view with it's possibilities with a task folder view.
    Any ideas?
    Warm regards
    bitschnau

    There's no out of the box way to achieve what you're looking for.
    Two solutions:
    1. Your users would need to open the entry first and then click on the "edit this file" link.
    2. You could code your own folder view or landing page element and build what you need.
    HTH
    Cheers
    Erik
    PS: Feel free to contact me offlist if you need professional support.

  • LV 7.1 - How can I use installer to create folder with its files included w/o adding each file?

    I have several files to place in folders created by the installer. Can't seem to see how I can avoid adding each file individually at build time. Is there an easier way to do this? Simply "adding" a folder would be a solution.
    Thanks
    Fran

    Fran,
    I believe this question is directly addressed in this online Knowledgebase.
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

Maybe you are looking for

  • DOWNLOADS FROM TRASH FOLDER

    I have founbd a further problem somewhat related to my previous posting today. My Windows live Mail is downloading the emails which BT has been moved to the trash folder.  Surely if they have been regarded as trash, it should not be possible for them

  • How can i download apps from itunes on my laptop to my ipod touch 1st gen

    i downloaded some apps from itunes on my laptop but they wont go to my ipod

  • Error message on install of itunes 10.5

    hoping someone can help, I just downloaded itunes 10.5 and when I tried to install I got an error message that said: "there is a problem with this windows installer package.  A program run as part of the setup did not finish as expected.  Contact you

  • Read Cursor isolation level

    Using Berkeley DB version 4.5. DB environment is opened with following flags: DB_CREATE, DB_RECOVER, DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_TXN, DB_INIT_MPOOL, DB_PRIVATE and DB_THREAD. My requirement: I need to use the cursor to iterate over all objects

  • SOA - Error Starting SOA

    Please, can someone suggest me on this error, occuring when starting SOA. *<Feb 8, 2013 2:56:08 PM WIT> <Error> <oracle.sdp.messaging.driver.email> <SDP-26123> <Could not initialize Email Store for user [email protected] >* *<Feb 8, 2013 2:56:08