Create folder and copy files problem

Hello all indesign script Members
where I work we use a permanent folder structure for an example
a jobnumber called "123123"
I have wrote a little interface called interface.jsx, this file is saved and located in
123123/scripts/interface
I want my interface to navigate two folders up
to 123123/source/ creates  a folder called "hej" so result is "123123/source/hej"
then I can pick from a little dialog box the folder 123123/source/a/ copy all .indd files to the folder hej (or any other folder I choose from the dialog box)
I want the script to know the active path instead of whole locations because, we have different project numbers all the time.
then run an extern script called hej.jsx
the best should be also if the script could chose 123123 as default jobnumber too.
Please could  someone help me to script this?
/get started I am very newbie
Thank you so much in advance
All Adobe Members

Hi tjacobs01,
Thanks for reply. I didnt include main method since i dont want to make the problem looks too complicated. I called both of the methods in main. The following is the simplified class code including main method.
import java.io.File;
import java.io.IOException;
public class TestClass{
public void buildFolder(){
File f=new File("/documents/hospital_backup");
if(f.exists()==false){
f.mkdirs();
public void copyFile(String file){
String form_cmd="cp /job_holding/hospital/" + file + " /documents/hospital_backup/"+file;
String[] command = new String[]{"sh", "-c", form_cmd};
try{
Runtime r=Runtime.getRuntime();
Process p =r.exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);}
int exitVal=p.waitFor();
System.out.println("Process exitValue:"+exitVal);
}catch(Exception e){System.out.println(e);}
public static void main(String[] args) {
String dir_root="/job_holding/hospital/";
File f=new File(dir_root);
File[] fList = f.listFiles();
for (int i=0; i<fList.length; i++)
String file=dir_root+fList.getName();
TestClass test = new TestClass();     
test.buildFolder();
test.CopyFile(file);

Similar Messages

  • 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

  • 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.

  • Batch create folder and move files

    Hi,
    I have files such as:
    FD3_xxx1
    FD3_xx2
    Fd3_xxx3
    FD63_xxx1
    FD63_xx2
    Fd63_xxx3
    How would I create a batch file that would create folders with the characters before the "underscore" and then add the files into them. For example, all "FD3" files will go in a folder called "FD3" and all "FD63" files will go into a folder called "FD63".

    Dear Frederik and/or Bill,
    I have come across this question and your answer and it seems that this is a solution to may problem as well. However, you say that a user needs "to activate it to do something useful". I have no experience in programming and I do not know how to activate
    it. Please let me what to do to make this work.
    One needs to be careful when running batch files that move or delete large numbers of files in one fell swoop. This is why I posted the file in a passive form. To be on the safe side you must do this:
    Open a Console session with cmd.exe.
    Invoke the batch file in its current (=passive) form.
    Carefully examine the screen output it generates.
    If the output fully agrees with your expectations, activate the batch file by modifying this line
    echo move %1 %Folder%
    to read like so:
    move %1 %Folder%
    Why? Because the batch file command "echo" will write things to the screen but do nothing else. Hence the command
    echo Hell World!
    will put the phrase "Hello World!" on the console screen. Once you remove the word "echo", you will actually execute the "move" command:
    move %1 %Folder%
    A general observation: I feel somewhat uneasy about you running a batch file that includes advanced commands, apparently without you really knowing what it is doing and how it is doing it. Performing the task manually might be a safer option.

  • How to create parameter and control file like filename + date

    Hello there
    I am trying to create parameter and control file with following command
    in SQLPLUS
    create pfile='/u03/oradata/WEBDB/backup/initWEBDB.ora' from spfile;
    In RMAN
    copy current controlfile to '/u03/oradata/WEBDB/backup/cf_longterm.cpy';
    how can I put date at the end of filename like
    initWEBDB8jan06.ora and cf_longterm8jan06.cpy
    Thanks in advance
    Lionel

    ASM is reliable but a smart DBA is very careful. If ASM is doing mirroring this is like RAID doing mirroring. What happens if you accidentally delete one copy ... the other one disappears instantly. Not a good idea.
    With respect to redo logs you need a minimum of three groups, two members, and one thread per instance. So a 2 node cluster should, at a minimum have 12 physical files.
    Not mirroring the redo logs, assuming multiple members, is not as critical.

  • Aborting index build. Too many errors with finding and copying files ...

    Hi dears,
    I'm using UCM 11g.
    I'm trying to start the automatic update cycle. When i start it, it gives me an error message just like :
    Indexing aborted at :<time>. Aborting index build. Too many errors with finding and copying files to the appropriate place.+
    Can anybody help me about this problem?
    Helps will be appreciated.
    Erdo
    Edited by: erdo on 28.Mar.2013 11:11

    Read this: error in Collection Rebuild Cycle
    and maybe also UCM Indexer - Collection Rebuild Cycle errorring out

  • Upload and Copy files using PLSQL.

    Hi All,
    Can UTL package can be used to upload any local data file to server?
    Or is there any in-built package which can be used to upload files to servers and copy files to another directory?
    Thanks in advance.

    Avishek wrote:
    Thanks.
    But i've a requirement to upload and copy files from one directory to another.
    How can i approach?Realize we only know what you post & so far you have posted NOTHING useful.
    How exactly does end user interact with the DB?
    3-tier application?
    EndUser<=>browser<=>WebServer<=>ApplicationServer<=>DatabaseServer
    What OS name & version for client system?
    Handle:      Avishek
    Email:      [email protected]
    Status Level:      Newbie (5)
    Registered:      Jun 3, 2008
    Total Posts:      68
    Total Questions:      27 (16 unresolved)

  • 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.

  • My 5 year old MacBook Air is telling me it "cannot save information about your mailboxes because there isn't enough space in your home folder.  Quit mail, delete files you don't need, then reopen mail."  What is "home folder," and which files to delete?

    My 5 year old MacBook Air is telling me it "cannot save information about your mailboxes because there isn't enough space in your home folder.  Quit mail, delete files you don't need, then reopen mail."  What is "home folder," and which files to delete? Thanks.

    The home folder is where all of your personal files are kept.
    Best candidates to delete are movies, videos, music and photos since they generally take the most space.
    Don't forget to empry the Trash after you delete the file because the space is not returned until the Trash is emptied.
    Allan

  • Folder actions - copy files AND subfolders

    I cannot seem to get folder actions working in the expected way.  I have no problem creating a folder action that copies files into the target destination folder.
    But if I create a new folder in the source folder (i.e. a subfolder) it does not create that same subfolder in the target. And of course by consequence, does not copy the subfolders files into the target either.
    Can anyone recommend an automator folder action step that I may be missing?  I'd appreciate any feedback, thanks!

    Thanks for offering to help. 
    I'm using automator with the following two steps:
    - first the default step where automator asks for a folder to attach the folder action to. I selected a folder called test input 1
    - second step is the 'copy finder items' step. I designated a named folder 'test output' and selected the checkbox 'replace existing files' (although I know that all of the folders/files that will be placed in the initial folder will be unique
    I just discovered that I pulled a bit of a rookie mistake. I had the target folder open and incorrectly assumed that my script wasn't working. When in fact I needed to close and reopen the window to refresh.
    However...
    After testing this script quite a bit, it seems very inconsistent.  While subfolders to get created, dragging and dropping some files yields a total inconsistency in the results. I have a particular PDF that refuses to get copied to the target via this script in a subfolder. 
    So I guess my updated status is: I have a script that works, but I don't really trust it because it doesn't always work properly.

  • HT2488 I imported pictures into iPhoto from my iPhone, when trying to find my pictures by clicking on iPhoto Library it is always empty. I had to create a new folder and copy the same exact pics in the new folder just to be able to access them.. help plea

    I imported photos into iPhoto from my iPhone, however i cannot access them. When clicking on iPhoto Library where they should be stored the folder is blank but if i open up iphoto from the dock menu they appear. I had to create a new folder just to access them. help please, because making a new folder takes up unnecessary space.

    There are many, many ways to access your files in iPhoto:   You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    There's a similar option in Outlook and many, many other apps.  If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    If you want to access the files with iPhoto not running:
    For users of 10.6 and later:  You can download a free Services component from MacOSXAutomation  which will give you access to the iPhoto Library from your Services Menu.
    Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and 10.5 Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Show File:  a. On iPhoto 09 and earlier:  Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.    3.b.
    b: On iPhoto 11 and later: Select one of the affected photos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder window will pop open with the file already selected.

  • Script to take every 5th file from a folder and copy it to another folder

    How can I tell applescript to take every 5th file of a folder of say 2000 files and copy them to another location? I want to copy the 5th, 10, 15th, 20th files and so on of 2000 files so I will have only 400 files.
    I guess I want to make a list of all the files and then coerce that to the first and then increments of five but how do I do that?
    Thanks.
    Pedro

    Hi Pedro,
    The following script should do what you are asking for:
    *set theSourceFolder to choose folder with prompt "Select the source folder."*
    *set theTargetFolder to choose folder with prompt "Select the target folder."*
    *tell application "Finder"*
    *set theFiles to files of theSourceFolder*
    *repeat with k from 5 to (count theFiles) by 5*
    *move item k of theFiles to folder theTargetFolder*
    *end repeat*
    *end tell*
    Message was edited by: Pierre L.

  • Creating a Folder and uploading file into that folder Inside OneDrive in Office365 programmatically

    I am using this below code to create a folder inside onedrive in office365,but i cant able to access the url for accessing my personal onedrive,it causing error "Cannot connnect to the server"
     using (ClientContext clientContext = new ClientContext("https://claysys123-
    my.sharepoint.com/personal/anju_claysys123_onmicrosoft_com/Documents/Forms/All.aspx"))
                    SecureString passWord = new SecureString();
                    string currentyear = DateTime.Now.Year.ToString();
                    foreach (char c in "MyPassWord".ToCharArray()) passWord.AppendChar(c);
                    clientContext.Credentials = new SharePointOnlineCredentials("username", passWord);
                    Web web = clientContext.Web;
                    clientContext.Load(web);
                    clientContext.ExecuteQuery();
                    clientContext.Web.Folders.Add("https://claysys123.sharepoint.com/_layouts/15/start.aspx#/Shared%20Documents");
                    clientContext.ExecuteQuery();
    but whenever am executing this clientContext.Web.Folders.Add("https://claysys123.sharepoint.com/_layouts/15/start.aspx#/Shared%20Documents");
                    clientContext.ExecuteQuery(); causes Error "cannot Connect to The Server"..pls help me as soon as possible..
    please give me sample code to get rid of this problem.

    Creating folder in One drive is equivalent to communication with document library. Here are all the samples to create folder in document library.
    http://social.msdn.microsoft.com/Forums/silverlight/en-US/985bab38-7e81-498c-97d8-534e6ee4cf11/how-to-create-folders-based-on-logic-using-client-object-model-2013?forum=sharepointdevelopment
    Bala

  • Copy File Problems

    First off, my problem is this. I know the only way to copy over a folder
    is to create a new folder where you want to copy the original folder to and copy each file over seper
    ately, then remove the old file....for some reason my copy seems to be failing. Here is the code.
    function moveItems(fName,pNum) {
        temp1 = new File('/p/toConvert/regular/'+fName+'/ImageProperties.xml');
        fileObject = new Folder("/p/toConvert/Done/"+pNum+"/"+fName);
    if(fileObject.exists){   
        check = temp1.copy ("/p/toConvert/Done/"+pNum+"/"+fName);
        alert(check);
        return;
        }else{
            alert('not there');
        if(check){
        temp1.remove();
        return;
    temp1.remove(); works and removes the old file, however my alert says that check failed, even though remove worked so we know temp1 exists, and since fileObject.exists was passed to get the alert....I have no clue what the deal is, it just wont copy. Any help would be appreciated, thanks.

    Mike, I have been playing with copying directories with contents on my mac. I would normally with AppleScript & Shell. What I have is working but I do think Im going about this in an untidy way with my JavaScript? Im using bridge to issue the system commands. Just about the only thing I've gotten to work with bridgetalk…
    using fsName on a folder omits the final backslash should I be using a decodeURI
    also is there a cleaner method to wrapping file path strings so that they are enclosed in single quotes?
    Here was my test code
    var defaultFolder = new Folder ('~/Desktop');
    // Get user selected source folder
    var sourceFolder = defaultFolder.selectDlg('Please select your Folder to sync files from…');
    var sf = sourceFolder.fsName;
    // Get user selected destination folder
    var destFolder = defaultFolder.selectDlg('Please select your Folder to sync files to…');
    var df = destFolder.fsName;
    // Add quotes to paths
    var shellString = 'rsync -auqE ' + "'" +sf + "/'" + ' ' + "'" + df + "/'";
    btMessaging('bridge', shellString);
    function btMessaging(targetApp, script) {
    var bt = new BridgeTalk();
    bt.target = targetApp;
    bt.body = 'app.system(' + script.toSource() + ');';
    //bt.onResult = function(inBT) {}
    //bt.onError = function(inBT) {}
    bt.send();

  • I have a folder and 3 files stuck on my desktop.  When I drag them to the trash I am asked to enter my administrator's password.  I do this but the files and folder will not delete.  I have checked 'Get Info' on each of them and they are not locked?

    I have an empty folder and 3 .jpg files stuck on my desktop.  When I drag them to the trash I am asked to enter my administrator's password.  I do this but the files and folder will not delete.  I have checked 'Get Info' on each of them and they are not locked and I have full read & write access.  Grateful for any assistance in solving this problem.

    Back up all data.
    Triple-click anywhere in the line below to select it:
    ls -@Oaen De* | open -f -a TextEdit
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. The title of the window doesn't matter, and you don't need to post that.
    If any personal information appears in the output, anonymize before posting, but don’t remove the context.

Maybe you are looking for

  • Error while opening Navigation setting is SharePoint 2013

    Unable to View negation bar and Also unable to open NavigationSettings in the site Setting. An error occured while rendering navigation for requested URL: /sites/PerformanceManagement. Exception message: Cannot open "/sites/PerformanceManagement/AFAQ

  • Adobe Premiere Pro CC (2010) crashes when adding video on MacBook Air 2013 model running Windows 7

    I updated PP to the 2014 version and every time I try to add video it crashes.  It also crashes right away if viewing the media browser in thumbnail view.  If media browser is in list view you can attempt to drag and drop video and then it crashes. 

  • Emails all work, but cant navigate from one to the other.

    before I could simply slide back on the screen, and it would take me to the previous level. Ex, from one account to the list of all accounts, or from one email back to the inbox. This somehow changed without me changing it. ***?

  • Keyboard Glitch

    This is what's happening to my keyboard. Should I be worried or take my phone back to the telus store? http://www.youtube.com/watch?v=_4kYbiygU6Ahttp://www.youtube.com/watch?v=n8_dxACdqkc However, it only happens when signing into the appstore after

  • Quicktime Player in Snow Leopard cannot download Apple HD Trailers

    Hi! I've had this same problem since couple of months ago I bought this MBP 17". I cannot watch the movie trailers from Apple. They download normally the first 45seconds (1/4 movie) or so, but then it completely stalls. The download rate drops dramat