Move footage item to folder problem.

Hi,
I have a problem. I have created script with following action:
Import footage.
Create "_MAIN_RENDER_FX##" comp from footage.
Precomp footage from _MAIN_RENDER_FX## to _MAIN_COMP_FX##.
Add it to render queue.
Create "Composition" and "Footage" folder.
Add comp to Composition folder and footages to Footage folder.
Problem is that if I move Footages to "Footages" folder in the script and launch script again to import another footage,
It will keep in memory older footage information. If I comment that section out which moves footages to "Footages" folder it works,
It even works if I move footage to folder by hand and run script again.
My script consists three functions:
getInfoItem(item) // takes footage item and parse filename to different keywords.
findFolderItemByName(name) // this just checks that if folder exists by given name.
ChooseFile() // This is where we do import stuff which i explained earlier.
Can you spot mistake from my code or give some advice to improve my coding (Im quite new of scripting)?
NOTE: This is hard coded to our project folder structure so getInfoItem function only works with this kind of folder structure.
Windows: X:\Projects\<Project>\Exports\VFX\FX##\
MAC: /Volumes/<NetworkDrive>/Projects/<Project>/Exports/VFX/FX##/
function getInfoItem(item){
    // Test OS
    var OS = $.os;
    if (OS.search("Windows") != -1) {
        OS = "Windows";
        var splitNum = 4;
    } else {
        OS = "Mac";
        var splitNum = 5;
    //  KEYWORDs
    this.fullpath = item.file;
    this.fullpath = String(this.fullpath);
    this.path_array = this.fullpath.split("/");
    this.fxnum = this.path_array[this.path_array.length-2];
     // split path based on splitNum variable which is based which OS currently in use.
    this.project_array= this.fullpath.split("/",splitNum);
    this.project_path = this.project_array.join("/");
    // Make a COPY from this.path_array
    this.path = this.path_array.slice();
    // remove last cell (Filename)
    this.path.pop();
    this.path = this.path.join("/");
    this.path = this.path + "/";
    this.fps = item.frameRate;
    this.duration = item.duration;
    this.width = item.width;
    this.height = item.height;
    this.name = item.name;
    this.left_index = this.name.indexOf("[");
    this.right_index = this.name.indexOf("]");
    this.sub = this.name.substring(this.left_index+1,this.right_index);
    this.filename = this.name.substring(0,this.left_index-1);
    this.splitted = this.sub.split("-");
    this.first_frame = this.splitted[0];
    this.last_frame = this.splitted[1];
    this.ext = ".dpx"
    // FOLDER RULES
    var padding = "#########################";
    this.aeProjectFolder = "/Project_Files/AE/";
    this.renderFolder = "/Renders/VFX/"+this.fxnum+"/";
    this.padnum = String(this.first_frame).length;
    this.outputseq = this.project_path+this.renderFolder+this.filename+"_["+padding.slice(-this.padnum)+"]"+this.ext;
    var outputfile = this.outputseq.slice(0,-this.padnum-6);
    this.outputfile = outputfile + this.first_frame + this.ext;
function findFolderItemByName(name){
        var found = false;
        for (i = 1; i <= app.project.numItems; i++){
            if (app.project.item(i).name == name && app.project.item(i) instanceof FolderItem ){
                var myFolder = app.project.item(i);
                found = myFolder;
                break
        return found;
function ChooseFile(){
    var myItem = app.project.importFileWithDialog();
    var checkFile = 1;
    var footage = new getInfoItem(myItem[0]);
    var rndFolder = footage.project_path+footage.renderFolder;
    // Create MAIN RENDER Comp
    var comp = app.project.items.addComp("_MAIN_RENDER_"+footage.fxnum,footage.width,footage.height,1,footage.duration,footage.fps);
    // Check if comp or footage folder exists. otherwise create it.
    if(!findFolderItemByName("Compositions")){
        var compFolder = app.project.items.addFolder("Compositions");
    else{
        var compFolder = findFolderItemByName("Compositions");
    if(!findFolderItemByName("Footages")){
        var footageFolder = app.project.items.addFolder("Footages");
    else{
        var footageFolder = findFolderItemByName("Footages");
    // Add footage to _MAIN_RENDER_FX## Comp. 
    comp.displayStartTime = footage.first_frame/footage.fps;
    comp.layers.add(myItem[0]);
    // Precomp layer from _MAIN_RENDER_FX##
    var layerIndices= [1];
    var precomp = comp.layers.precompose([1],"MAIN_COMP_"+footage.fxnum);
    precomp.parentFolder = compFolder;
    // add Comp to render Queue
    rqi = app.project.renderQueue.items.add(comp);
    // Find DPX template and apply
    for (x in rqi.outputModules[1].templates) {
        if (rqi.outputModules[1].templates[x] == "DPX" ){
            rqi.outputModules[1].applyTemplate(rqi.outputModules[1].templates[x]);
            rqi.outputModules[1].file = File (footage.outputseq);        
    // Put all footage items to footage folder
    for (i = 1; i <= app.project.numItems; i++){
            if (app.project.item(i).typeName == "Footage"){
                    app.project.item(i).parentFolder = footageFolder;
ChooseFile();
Thanks,
.M

sorry, lost track of this thread for a while. this is actually pretty easy. the simplest would be to use applescript only but it can be done with automator with only minimal use of applescript. I don't know how to do it without using apple script altogether.
make the following workflow in automator.
1. get selected finder items.
2. run applescript
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
on run {input, parameters}
tell application "Finder"
container of item 1 of input as alias
end tell
end run</pre>
3. set variable value.
make a new storage variable and use it in this action.
4. run applescript
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
on run {input, parameters}
end run</pre>
this is adummy action to break the workflow chain.
4. get selected finder items.
5. make new folder.
drag the variable you made to the "where" field.

Similar Messages

  • Printing items in a folder problem - help

    Ok, I've created a workflow that basically goes like this:
    Get specified items
    Get folder contents
    Filter contents for text files
    Print text files
    Move text files to somewhere else
    I then save it as a folder action plug in and assign it to a specific folder so that the script runs when I insert a file into the folder. When I do, the script runs ok, goes through all the steps, opens up Printer Setup Utility and the Print dialog but nothing comes out the printer.
    If I look at the completed items list on the printer, it shows like the file was completed but the printer never actually printed anything.
    Is this a problem with the printer driver or with Automator? Anyone have an idea what might be happening? If I substitute "Print File" for any other command like "Open File" it works great. It seems the problem is somewhere in the printer. If I open the file and Print it, everything works.
    Is there anyway I can get the script to not open the Printer Setup Utility and the Print Dialog box?
    iMac G5 17"   Mac OS X (10.4.7)  

    Iam not able to set the main folder's (i.e INPRISE) acl (MyAcl) on the subfolder "MyFolder" because the owner of MyAcl is "system" whereas the owner of MyFolder is user "i1" .Which is the best way of solving these ownership issue which iam running into ? I want to be able to create different folders ,assign a group of uers to each of the folders who can create as well as modify,delete each other's folders/documents (as i have mentioned in my first post in this thread) ?
    thanks
    Srinivas

  • Folder Action + Move Finder Items = Zero KB files

    I've got a folder action set that is supposed to run the Automator Action "Move Finder Items" on any file that gets placed in a specific folder (called "Folder A") and move it to "Folder B". I'm having an issue with larger files though.
    As soon as I begin to transfer the file to "folder A" , the folder action runs and results in a "Zero KB" file in "Folder B".
    Is there any way to keep the Folder Action from triggering until the file has completely copied to the folder with the Folder Action attached ("Folder A")?
    A side note: I have this same folder action running on an iMac with Mac OS 10.6.3 and it works great . (This one was made with the newer version of Automator that shipped with 10.6 vs. Automator on 10.5 which made the action I am having trouble with)
    Any input would be appreciated!

    There is a check in *Snow Leopard* to see if the items have completed their copy/download, but Leopard does not do any checking - the script is triggered immediately. You can add your own delay with a *Run AppleScript* action, though, for example:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- wait for file copy to complete by testing the size of the containing folder
    set theFolders to {} -- to handle items in different folders
    set skippedItems to {}
    repeat with anItem in the input -- get a list of unique folders
    tell application "Finder"
    get (container of anItem) as alias
    if the result is not in theFolders then set the end of theFolders to the result
    end tell
    end repeat
    repeat with aFolder in theFolders
    set timeToWait to 30 -- time to wait for copy to complete
    set interval to 2 -- test every interval seconds
    set copied to false
    tell application "Finder" to set currentSize to size of aFolder -- get initial size
    repeat with timer from timeToWait to 1 by -interval -- check every interval seconds up to maximum time
    delay interval
    tell application "Finder" to set newSize to size of aFolder -- recheck size
    if (newSize is equal to currentSize) then
    set copied to true
    exit repeat -- success
    else -- update size
    set currentSize to newSize
    end if
    end repeat
    if not copied then set the end of skippedItems to quoted form of (aFolder as text) -- timed out
    end repeat
    showSkippedAlert for skippedItems
    return input
    end run
    to showSkippedAlert for skippedItems
    show an alert dialog for any items skipped, with the option to cancel the rest of the workflow
    parameters - skippedItems [list]: the items skipped
    returns nothing
    if skippedItems is not {} then
    set {alertText, theCount} to {"Error with waiting for items to copy", count skippedItems}
    if theCount is greater than 1 then
    set theMessage to (theCount as text) & space & " folders timed out"
    else
    set theMessage to "1 folder timed out"
    end if
    set theMessage to theMessage & " - copy of contents may be incomplete:"
    set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {skippedItems, AppleScript's text item delimiters} to {skippedItems as text, tempTID}
    if button returned of (display alert alertText message (theMessage & return & skippedItems) alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end showSkippedAlert
    </pre>
    The action will check the folder sizes, and when there is no change (or the wait times out) the input items are passed on.

  • Problem with next N items in folder

    Hi,
    When I set restriction on number of items in folder (set Number Of Rows field in folder style -> Edit Region) for example 5. I see 5 items in folder. But I cant see next set of item because there isnt link next 5. Is it bug?
    Im using portal version 3.0.9 on Sun Solaris.
    Thanks
    Michael

    HI,
    wat i understand is u r trying to loop at a variable window .but tht is not suggestable.
    write a loop in program lines. read the values in to different variables and the try printing them as text elements that will solve the problem.
    or else in other way use a template and that can also solve the problem.

  • Search for a footage item within a folder item?

    how do you search for a footage item that may be in a folder item ?
    eg: i have a comp as the first item in my project panel, then i have a folder containing the three footage items that belong to that comp below.
    in my script i want to create a variable to store a particular footage item called "background". though i dont know how to search for it if its contained within a folder (called "footage").
    can anyone pleease help a newbie
    thanks,
    Sam

    Like this:
    var myFootage = null;
    for (var i = 1; i <= app.project.numItems; i++){
      if ((app.project.item(i) instanceof FootageItem) && (app.project.item(i).name == "background")){
        if (app.project.item(i).parentFolder.name == "footage"){
          myFootage = app.project.item(i);
          break;
    // at this point myFootage is either your background footage, or null if not found
    Dan

  • How do I move my iTunes Music folder to a new hard drive?

    I've installed a new drive in my Mac Pro. I now have to move my iTunes Music folder into the new drive and junk the old one. I know that I can use iTunes/File/Add to Library menu item to get iTunes to locate the new Music Library; however, this is going to leave me with two entries for every track, one good and one broken after I remove the old drive. I think I should junk the old library and then have iTunes rebuild it from the Add To command... what is the best way to avoid problems? Select All, move to Trash and then locate and add them back?  Expert advice appreciated.

    No, it's simpler, epecially if iTunes manages your music for you (default).
    iTunes: How to move your music to a new computer [or another drive] - http://support.apple.com/kb/HT4527
    do not confuse moving your whole folder and library with moving just media files as in
    iTunes for Mac: Moving your iTunes Media folder - http://support.apple.com/kb/HT1449
    Quick answer if you let iTunes manage your music:  Copy the whole iTunes folder and all its subfolders and files intact to the other drive.  Start iTunes with the option key held down and guide it to the new location of the library.
    I'm not sure abot your model Mac but you might be able to do this with the computer in Firewire Target Disk Mode.
    How to use FireWire target disk mode - http://support.apple.com/kb/HT1661 - includes description of hardware and software requirements.
    Target Disk Mode - Mac OS X 10.6 Help: Transferring files between two computers using FireWire - http://docs.info.apple.com/article.html?path=Mac/10.6/en/8443.html

  • Can't move "completed" items into folders using Outlook 2013 on a Microsoft Office 365 Home Premium Account using a work Exchange 2010 address

    I've been in touch with several Microsoft support teams about this issue, and the latest move was to shove me off onto Pro support, but since I'm using a personal Office account, I'm hoping that through the community I can find a way to resolve this issue without
    escalating through our IT department. I do not think this is an Exchange issues because I have previously used this product and method without resulting in this error on a Windows 7 32-bit AMD computer and a Windows 8 and 8.1 Professional 64-bit Intel computer.
    Here's my current specs:
    Windows 7 Professional 64-bit, service pack 1
    AMD A6-5400 3.6 GHz
    8GB RAM
    Microsoft Office 365 Home Premium
    Office updates automatically, version 15.0.4551.1512
    About Outlook shows "Microsoft Outlook 2013 (15.0.4551.1511) MSA (15.0.4551.1508) 32-bit/Part of Microsoft Office 365 Home Premium"
    Here's how to reproduce the issue:
    1) Open View Settings
    2) Select "Other Settings..."
    3) Disable "Use compact layout in widths smaller than XX characters" and enable "Always use single-line layout"
    4) Select "Columns..."
    5) Under "All Mail fields" add "In folder"
    6) Select any email
    7) Context-menu -> Find Related -> Emails in this Conversation
    8) Select "more"
    9) Sort by folder
    10) Select all messages from Inbox.
    11) Use Outlook's preset "Done" function and select a destination folder
    12) Watch Outlook fail to run "Done" and reset your UI without producing an error.
    The first attempt to resolve this issue was to set up a new Outlook profile. This seemed to exacerbate the problem and resulted in Outlook providing an "Unknown error" before resetting the UI.
    The second attempt to resolve this issue was to run "outlook.exe /resetnavpane". However, the nav pane does not appear immediately relevant to this issue.  
    The following similar steps also result in a crash, this time with an error:
    11) Flag all select message as Complete.
    12) Move all messages from Inbox to a destination folder.
    This change in procedure results in the error "Cannot move the items. Some items cannot be moved. They were either already moved or deleted, or access was denied."
    Help me, Microsoft Community. You're my only hope.

    Import the calendar and contacts in Outlook.com. For contacts, export from Outlook as csv and import into Outlook by choosing the Other option (https://people.live.com/import/other?biciid=ImportCatalog) 
    You'll need to save the calendar as an ics file to import it. Select the calendar folder, the File, Save as an save as an ics. 
    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

  • Folder problems on external drive, not showing correct file size

    I've run across a strange problem. I'm media managing for a tv show, meaning I'm offloading video from CF cards onto 2 external drives, one is a Drobo Raid (set up for backup) and another is a Lacie rugged drive. After copying the media to both drives, the folder I copy will match, but sometimes as I drill upward in my folder structure, suddenly the file sizes will not match. To be more clear: 2 folders will show differing file sizes, but inside that folder is only another folder,nothing else, which matches across the drives. I've shown all files in finder and there's no hidden files, though sometimes I see the ds_store files are different sizes (8k vs 16k), but that's not always the case. Sometimes if I simply create a new folder and move it's contents into it I can get the folders to match, but sometimes that doesn't work. It's part of my workflow to show that these copies match exactly via screenshots, and although the most important folder (the direct folder holding the footage) always matches, these folder problems are super frustrating as it's not constant, and any workarounds also work inconsistantly.
    I had an accidental disconnect of the Drobo one time, and although none of the data seems to have any problem, I fear it's done something to the directory. The rugged drive is swapped out every few days and the problem seems to be on the Drobo. Because the nature of the data is pretty important, I'm afraid to just try messing around with repairing or other software solutions unless I know it's super safe and won't harm the data.
    I'm at a loss as to what's causing it and at the very least how to avoid it cropping up. Any help or insight would be appreciated!

    I had the same problem with my iMac, first I repaired the disk, then I ejected the disk, restarted, and then reinserted the USB in a different port.  All of my files magically showed up.  I don't know what caused the error but it has been working fine since. 

  • Automator (move finder items)

    I have a service that moves finder items to a particular folder. Since I started using this I noticed I occasionally will need to move an item with the same name into this folder. Is there a way I can get the service to move the second item with the same name, but instead of overwriting the first item, have it add a -1 or something? If I open something like a zip file multiple times in finder, it creates the second one with a 1 after the name. That's exactly what I need. Any way to do that with a service like this?

    No, I didn't give up on the thread, I just went to work with what you gave me to see what I could do with it. It's just that you've been nothing but extremely helpful and patient with me in the past; and I started to feel like I was coming to the board, putting up my problems, and you do everything for me. I know you're here to contribute to the community, but I don't like to take advantage. I am making an effort to learn this stuff now, I just have to make baby steps!
    Okay, here is the deal with this item. I actually want to apply this with more than one operation, but the basic script or concept would remain pretty much the same. We create lots of documents like invoices, receipts, shipping labels, etc., that usually get saved as pdf onto the desktop. Then, they are named, often with the date and particular file name and finally moved into the proper folders. For example, shipping labels get saved to desktop with the default name of something like
    vty3RlsIK.LabelGenerationServlet.part
    Then I would change the name to something like
    12-31-2009USPSLabel.pdf
    Then, I would move it to the folder where we keep the shipping labels for records.
    So, the service I created actually does more than just moving the file. It goes like this:
    service receives selected pdf
    in finder
    name single item in finder item names (to: USPS_Label.pdf)
    add date or time to finder item names (before name, underscore separator)
    move finder items (to target folder)
    open finder item (with default application)
    The other ones I need would be similar, except they don't usually need to be opened afterward, just named and moved, for the most part. I figured I could continue to just use the name change function of automator before running the script, but if would run faster or more efficiently if that were also part of the script, I suppose that would be better. And I would like to be able to have the numbers go up through as many as I need. If it's a matter of just adding in all the possibilities of existing names up to the number I need, that's tedious work I don't mind doing now to save on having to name all these files in the future!
    Also, these files are always named differently, so the source file would need to just be selected file, not the actual name.
    Finally, I tried to play with the script to name the desktop like you said, but would it be something like
    set source_folder to folder (path to desktop)
    or
    set source_folder to (path to desktop)
    I still need to learn a little more before I understand the way that works. I am so used to only using the unix path, I like the ability to use (path to desktop) that's really interesting.
    I think I may have rambled a bit, but that should explain the details of what I'm trying to accomplish.
    thanks

  • Cannot move the items. You don't have appropriate permission to perform this operation.

    Recently, I upgraded outlook from 2007 to 2010, but I got a problem that I cannot move any mails to personal folder and the error msg is "Cannot move the items. You don't have appropriate permission to perform this operation.".Even I create a new personal
    folder in 2010 and try to move mails to it, I still get that error message. 
    Can anyone help me out please?
    Thanks so much in advance.

    I've experienced the same thing and was unable to find this key that Tony mentioned.  After searching numerous sites, i found this instruction set below and tried it and it worked.  Per my case, the key PstDisableGrow was set to 1 under ...\Software\Polices\...
    instead.  I disabled it and bam, it worked.  Give this a try...
    Your System Administrator has either enforced a group policy to prevent pst files growing in size or a registry key is present preventing the growth of pst files. One of the following
    registry keys will be present based on your version of office (11.0 for Office 2003, 12.0 for Office 2007 and 14.0 for Office 2010). The example below is for Office 2010 (14.0):
    HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\PST  - DWord Value: 'PstDisableGrow', Value: 1
    HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\PST  - DWord Value: 'PstDisableGrow', Value: 1
    Best of luck!

  • Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that- thanks

    Can any one tell me how can I move to a different folder pictures, that I've cloned, without them staying aggregated? They all come together to the other folder and I don't want that… thanks

    There's more to it than that.
    Folders in Aperture do not hold Images.  They hold Projects and Albums.  You cannot put an Image in a Folder without putting it in a Project or an Album inside that Folder.
    The relationship between Projects and Images is special:  every Image must in a Project, and can be in only one Project.
    Images can be in as many Albums you want.  Putting an Image in an Album does not move it from the Project that holds it.
    You can make as many Versions from a Master as you want.
    What you want to do may appear simple to you, but it still much adhere to how Aperture works.  I still can't tell exactly what you are trying to do (specifically: Images don't live in Folders; moving an Image from a Folder is non-sensical).
    It can be very confusing (and frustrating) to get going with Aperture -- but it does work, and can be enormously helpful.  If you haven't, take a look at the video tutorials on Apple's Aperture support site.
    I feel as though I haven't helped you much -- but we need to be using the same names for interface items in order to get anything done -- and my sense is that you still haven't learned the names of the parts.

  • So I have a file on my desktop and I cannot open it, move it to a folder, or delete it from my mac. I dont know what it has in it, and that makes me suspicious. What can I do to remove this unremovable file from my computer? Is it a virus?

    So I have a file on my desktop and I cannot open it, move it to a folder, or delete it from my mac. I dont know what it has in it, and that makes me suspicious. What can I do to remove this unremovable file from my computer? Is it a virus?

    First, I would recommend repairing the hard drive with Disk Utility.
    If that doesn't fix the problem, there's a very dangerous command you can execute in the Terminal.  This is very hazardous, because a simple typo can result in very drastic consequences.  I have seen people erase their entire hard drive by putting a space in the wrong place!  So, please follow the directions I'm going to give you very carefully!
    Open the Terminal, which is found in the Utilities folder in the Applications folder.  In the Terminal, enter the following:
    sudo rm -f
    Make sure to put a space after the "-f"!  Then, drag the troublesome file from the Finder and drop it on the Terminal window.  That should insert the path to the file in the command.  Then go back to the Terminal and press return.  You will be asked for your password, and when you type it, nothing will be shown as a security measure.  Press return again after entering your password.  The file should be deleted.

  • Move file to new folder if it does not exist already

    I have tried what feels like a million ways to do this and none of them are working like I want.
    A file will be placed in folder 1 with a unique case number as the file name. IE 12345675.txt
    If the data in the file is changed a new file with the same file name will be placed out again that contains the updated info (for now I don't care about the update.)
    I want powershell to look for all the .txt files in folder 1 and compare them to the .txt files in folder 2 to see if that file name already exist.
    If it does not exist, I want to send a email with the content of the file and then move the file from folder 1 to folder 2.
    If it does exist then only move the file to folder 2 and overwrite the file that is already there.
    Sample:
    $folder1="C:\inetpub\cgi-bin" # Where Application will place incident file
    $folder2="C:\incidents"       # Once file is processed it is moved here
    $folder1Files=dir $folder1\*.txt    # Find all txt files in folder1
    $folder2Files=dir $folder2\*.txt    # Find all txt files in folder2
    $files = Get-ChildItem $folder1\*.txt   # Get all file that end with .txt
    foreach ($file in $files){
        $testfile="$folder2\$file"    #I know there is something wrong here but can think of how to fix.
        if (!(Test-Path $testfile)){
                                    Write-Host "NEW - Sending Page"
                                    $to = "email address 1"
                                    $from = "email address 2"
                                    $subject = "Pre Alert"
                                    $body = Get-Content -Path C:\inetpub\cgi-bin\*.txt
                                    $smtpServer = "mail.domain2.com"
                                    $smtpClient = New-Object Net.Mail.SmtpClient($smtpServer, 587)
                                    $smtpClient.EnableSsl = $false
                                    $smtpClient.Credentials = New-Object System.Net.NetworkCredential("Username",
    "Password")
                                    $smtpClient.Send($from, $to, $subject, $body)
                                    Write-Host "Moving File"        
                                    Move-Item -Path 'C:\inetpub\cgi-bin\$file' -Destination 'C:\incidents'
    -verbose
                            else{
                                    Remove-Item $file -include "*.txt"

    $testfile="$folder2\$file"
    What you're asking PowerShell to do there is to make a string which will start with the value of $folder2 (which you set earlier as a string) and then the value of $file, which is a document on the file system.
    PowerShell is pretty good at changing a value from one form to another (in technical terms, 'casting') but it's always best to help it along where possible.
    Why don't you try adding a 'Write-Host' line to say which file you're processing, and another line to say what file you're checking for. That should show you if you're building that string correctly or if you need to modify it.
    For now comment out the email section and just try to get it to tell you if the file already exists or not. Once you've got that done then try to build out the email bit. The trick is always to build small steps in Scripts and only move on once you've tested
    a section.
    $folder1="C:\inetpub\cgi-bin" # Where Application will place incident file
    $folder2="C:\incidents" # Once file is processed it is moved here
    $folder1Files=dir $folder1\*.txt # Find all txt files in folder1
    $folder2Files=dir $folder2\*.txt # Find all txt files in folder2
    $files = Get-ChildItem $folder1\*.txt # Get all file that end with .txt
    foreach ($file in $files){
    $testfile="$folder2\$file" #I know there is something wrong here but can think of how to fix.
    Write-Host "Checking for file at $testFile"
    if (!(Test-Path $testfile)){
    #Slightly modified
    Write-Host "NEW - Sending Page " $file.Name
    # $to = "email address 1"
    # $from = "email address 2"
    # $subject = "Pre Alert"
    # $body = Get-Content -Path C:\inetpub\cgi-bin\*.txt
    # $smtpServer = "mail.domain2.com"
    # $smtpClient = New-Object Net.Mail.SmtpClient($smtpServer, 587)
    # $smtpClient.EnableSsl = $false
    # $smtpClient.Credentials = New-Object System.Net.NetworkCredential("Username", "Password")
    # $smtpClient.Send($from, $to, $subject, $body)
    Write-Host "Moving File"
    Move-Item -Path 'C:\inetpub\cgi-bin\$file' -Destination 'C:\incidents' -verbose
    else{ Write-Host "File found, skipping and deleting new file"
    Remove-Item $file -include "*.txt"

  • I have been taking screenshots on my mac book pro and they have been saving to my desktop. However when i try to move them into a folder, they don't move at all! I have changed my setting in view options to 'none' but they still don't move?

    I have been taking screenshots on my mac book pro and they have been saving to my desktop. However when i try to move them into a folder, they don't move at all! I have changed my setting in view options to 'none' but they still don't move?

    Got to your Desktop folder in the Finder sidebar, command i will open the info pane.
    What are your permissions here? Unlock the pad lock and Change to read write.
    Are you experiencing other problems?
    Reset Home Directory Permissions and ACLs
    http://osxdaily.com/2011/11/15/repair-user-permissions-in-mac-os-x-lion/

  • Move files from one folder to another javascript?

    I am running a 3-action droplet automatically using windows task scheduler.  Here are the 3 steps:
    1.    Batch file to move files from hot folder to processing folder
    2.    Run IPP (dr brown's image processor pro) using preloaded settings to make several sizes copies of the files.
    3.    Bat file to move the files from processing folder to archive folder.
    The problem I am observing is that Step 1 works and IPP begins to run.  It only processes the first few images, and then moves on to the 3rd step where the bat file is ran to move all files from processing folder to archive folder.   The trouble is, only a few images were processes (about 10 or so), yet all of the images get moved to the archive without being processed.  Is there a way to make sure that step 2 (IPP) doesn’t begin until all files have successfully been moved from the hot folder to the processing folder?  IPP starts right away and files are still being transferred to the processing folder.
    Does anyone have a script that will move files from one folder to another? 

    I'm sure I have see a way to close down Photoshop in a Photoshop script.  I never had the need to.  It may be a simple statement like app.close(); I don't know javascript and only hack Photoshop script mostly by looking at others code.  app.close(); is a guess on my part. Let me try it. I was wrong its photoshop.quit();
    So make your MoveToArchive.jsx look something like this
    try{
       var BAT = new File(Folder.temp + "/MoveFilesToArchive.bat");
       BAT.open("w");
       BAT.writeln('Copy /Y "c:\\Process\\*.jpg" "c:\\Archive\\*.*"');
       BAT.writeln('Del "c:\Process\\*.jpg"');
       BAT.close();
       BAT.execute();   // execute the temp bat file
    }catch(e){
    alert("Bat MoveFilesToArchive  failed to execute.");
    photoshop.quit();

Maybe you are looking for

  • Patterns in bpm

    Hi all,   how many types of patterns are there in BPM? Thanks Keerthi

  • Setting Default SID

    guys, I have 3 database instances running on the server - oradev, oratest, oracnv from the prompt I have set the following C:\>set oracle_sid = oratest C:\>sqlplus /nolog SQL*Plus: Release 9.2.0.6.0 - Production on Wed Jul 19 16:29:02 2006 Copyright

  • Where can I view all Business rules that are currently running

    Hi, I was told that this is available in our Planning v11 but can't find it. where can I view all processes (such as Business rules) that users are currently running ? thanks.

  • Apple keyboard on a Netra T1

    Hi, does anyone know if an Apple USB keyboard will work with a Sun machine? Thanks

  • Powerline adapters: IP addresses.

    Hi, its not often I post here so hello again. I have been using powerline adapters since BTVision was introduced and now have the black ones. Recently my network has been slow, for all connected devices. The powerline status link is rarely green, mos