Cut and move files

Hi all

My request is to cut files from the source folder and put in the Destination folder.

By using the forum, I got the below coding, it must copy in the source folder and paste in the Destination folder.

 var sourceFolder = Folder.selectDialog("Select Copy Folder")

var destinationFolder = Folder.selectDialog("Select Paste Folder")

function copyFolder(sourceFolder, destinationFolder) {
    var sourceChildrenArr = sourceFolder.getFiles();
    for (var i = 0; i < sourceChildrenArr.length; i++) {
        var sourceChild = sourceChildrenArr[i];
        var destinationChildStr = destinationFolder.fsName + "/" + sourceChild.name;
        if (sourceChild instanceof File) {
            copyFile(sourceChild, new File(destinationChildStr));
        }
        else {
            copyFolder(sourceChild, new Folder(destinationChildStr));
        }
    }
}


function copyFile(sourceFile, destinationFile) {
    createFolder(destinationFile.parent);
    sourceFile.copy(destinationFile);
    //sourceFile.move(destinationFile);
}


function createFolder(folder) {
    if (folder.parent !== null && !folder.parent.exists) {
        createFolder(folder.parent);
    }
    folder.create();
}

Please someone help for the above request.

Thanks in advance

Beginner_X

Vandy works only when the Source file is empty.

"Folder.remove ()" can only delete the folder when the folder is empty.

In your case, I guess your source folder is not empty.

Therefore, the complete solution will be:

Change this line commented,

sourceFile.move (Destinationfilerequired);

with

sourceFile.remove ();

Using this will empty your source folder.

Then use "sourceFolder.remove ()" at the end of the script. to delete an empty folder.

Tags: InDesign

Similar Questions

  • Create folders and move files by reading csv

    Hello guys,.

    That can create a script to read csv and create folders and move files into the folder.

    My csv will look like

    Screen Shot 2015-11-11 at 5.25.29 PM.png

    There the names of folders and file names, I kept my files (Mention in the 'File name' column) in the office. When I run the script it must read the csv file and create the folder (depending on the "folder names") and the correct file must move in the particular folder. Hope I have clear requirements.

    So we need 4 above csv files and the respective files must travel in their records. Need help!

    Thing may have changed as I've tested with CS6.

    Please try then.

    #target photoshop;
    main();
    function main(){
    var csv = File.openDialog("Please select CSV file.","CSV File:*.csv");
    if(csv == null) return;
    var sourceFolder = Folder.selectDialog( "Please select source folder");
    if(sourceFolder == null) return;
    var data=[];
    csv.open('r');
    while(!csv.eof){
    var InputLine = csv.readln();
    if(InputLine.length > 3) data.push(InputLine);
    }
    csv.close();
    for(var f in data){
    var dataLine = data[f].split(',');
    var folderName = dataLine[0].toString().replace(/^\s+|\s+$/g,'');
    var fileName = dataLine[1].toString().replace(/^\s+|\s+$/g,'');
    var file = File(sourceFolder + "/" + fileName);
    if(!file.exists) continue;
    var outputFolder = Folder(sourceFolder + "/" + folderName);
    if(!outputFolder.exists) outputFolder.create();
    if(file.copy(outputFolder + "/" + fileName)) file.remove();
        }
    alert("All Completed");
    };
    
  • I want to rename and move files from a shoot 5 d. I would like to use the functionality of the increment to count, but since I have to get out of each file to the following file, it starts again at 1. What is the best way to do it?

    I want to rename and move files from a shoot 5 d on a new drive. I would like to use the functionality of the increment to count, but since I have to get out of each file to the following file, it starts again at 1. What is the best way to do it?

    HI -.

    As a prelude to 2014.0, we have added a feature allowing you to choose what number to start the increment of.  Look in the section ingest Rename dialog and change your preset. When you click the button, you should see the option "Custom Auto Increment". This will allow you to choose what number to start on.  We've also added a few newspapers to try to remember where let prelude last successfully interfere the operation by using this option. So, in theory, to remember the number for you. But if it isn't (maybe you want multiple kickoff ingested at the same time) you can always manually set the number to start with.

    Check that out and let me know how it works for you.

    Kind regards

    Michael

  • .mp4 and .mov files are just BIG

    Sorry, without posting the details of encoding, is there an obvious reason why my .mp4 and .mov files are ~ 10 x the size they should be after the SOUL? I'm talking about 300mb.mov and 30 MB .mp4 before later files. If you need details, I'll post. Thank you.

    File size is determined mainly by only two factors - length and bitrate.  The used codec, resolution, frame rate, etc. all have little or no effect on the size of the file.

    Length and bitrate.  If you want a smaller file, one or other of the people must be reduced.

  • Lost to cut and paste files

    I cut and copied some set of files of office (located in C :) to a folder in the d: drive. Another series got also copied in another location on the disk D of office. When I tried to copy the 3rd series of files, it might get copied. I cancelled the process 3 or 4 times. But nothing has managed. On the other hand, I've been facbooking on Google chrome. He got the hanged man. At the same time, windows Explorer got hanged. So I tried the Task Manager to end the task. It also did not work. Finally, I kept the CPU start button pressed and sutdowned the computer. To start the computer, I could not locate the files in the original folder or destination. I tried all sorts of recovery software to restore the file. But they could not locate the files. I thought that the files are not deleted, but their memory address is blocked, so I tried check disk (check 5 steps of readers). He repaired an area called '$J Journal USN' but still I couldnot find the files. Please help me!

    Hello

    Unfortunately, there is no other way to recover lost data. You can search for third-party software recovery that could help you.

    DISCLAIMER of THIRD PARTY SOFTWARE: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • Cut and paste files

    All those who use VMWare Player could cut and paste the files on a DVD RW drive on a comments system? Thank you.

    ODA

    ----------------------------------------------------------------------------------------------------------------------------------------

    14/01/2011

    Found a solution for the "DVD RW cut and paste problem" in my Windows XP feedback system.

    Installed the package free writing Drag2Disc software for Windows Vista (32 bit, 64 bit), XP (32-bit, 64-bit) of IBM/Lenovo on system invited and formatted a DVD disc.  Everything seems to work fine on the DVD RW drive systems of the host and the guest.

    The available Drag-to-Disc packet writing software can be downloaded from the following site:
    http://www-307.IBM.com/PC/support/site.WSS/document.do?sitestyle=Lenovo & lndocid = RAHUL-40970

    Thanks for the suggestions everyone.

    ODA

    you set up the writer as IDE

    in my experience, you must configure it as SCSI
    See http://sanbarrow.com/vmx/vmx-cd-settings.html

    even then, I'm not sure if the packet writing is supported - software for CD burning ordinary as Nero and others should work well

  • Disable copy and move files/folders in windows xp

    I want to warn the user domain to copy files or folders in windows xp

    You can't avoid it.

    There are other things you can do:

    • Enable auditing of file to their computers so that Windows saves which copy / move the files where on this computer.
    • Use NTFS permissions to prevent user access to folders and files, they do not have the authorization to do so.
    • Sticks to use Group Policy to prevent the use of USB.
  • Implementation of Adobe software and move files from another machine type

    Location:

    1. I got Lightroom 3 (LR3) for some time, but never really learned to use it. For various reasons, I recently decided to update LR3 and also buy Photoshop CS6.

    2 I have now installed LR3 to LR5. This software, PS C6 and the last 4 years of digital photos are present on my 15 "Macbook Pro.

    3 in addition to the MacBook, I have a 10-12 years old PC that runs on Microsoft XP Pro. I have maybe 3 000 digital photos from previous years that are stored on this computer. In all cases, regardless of the computer, the image files are enabled, they are a random mix of jpeg and raw (Nikon) files.

    My Questions are:

    1. Photo files are imported into the LR5, are picture files copied into a 'system of files of LR' and thus duplicate on my HDD files?... .or is it a case of LR making links to the files where they physically present? What? A sub question is this: when I delete a file in its original storage folder, which also deletes the image of the files accessed by LR?
    2. What do you suggest as the most effective method and the means to move the photos from my PC to my Mac?
    3. Can what advice you give about how to structure my photo files to make the simplest and most effective for LR5 and PS C6 to access the files. ?
    1. Lightroom creates a link to your photos; at no time Lightroom stores the photos in-house, so if you had a copy of a picture before importing, you still have a copy
    2. External hard drive is probably the most effective
    3. You can have any structure is evocative, ranging from "no structure" to "very structured. Lightroom simply does not care what is the structure of the folders, it can work with any folder structure whatsoever. My recommendation is to have a simple structure for your folders (such as dates) and then make the most of the organization inside Lightroom via keywords and other metadata.

    Paige

  • I want to map a drive of google as a network drive for copy and move files stored on a drive different server periodically. It is said

    invalid folder. How can I do this on Windows Explorer, longer aged and on my RT of Area2 8.1

    Hello Andrea,

    Thanks for posting your question on the Microsoft community.

    Thank you for details on the issue.

    This can happen due to some problems of synchronization with the disc you are trying to map.

    I suggest you use the "subst" command to map a folder as drive letter. Please follow these steps:

    a. type cmd in the start search box.

    b. right click on cmd in the search results, then click on run as administrator.

    c. type the following command at the command prompt and press ENTER.

    subst g: "c:\users\username\Google Drive".

    Additional information:
    https://support.Google.com/drive/answer/2565956?hl=en

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Rename / move files in Explorer says that the file is in use

    I have Windows 7 and Office 2010, I use Windows explore a lot of maneuvering around all the files that I deal in a day.

    With Windows 7, I can't rename and move files.  He says that the file is open, without being.

    I found a way to work around this problem by opening Excel or Word and doing a cut and paste.  I don't have to do!

    I don't have the "Preview" in the Explorer.  I want just the Explorer to be as easy to manoeuvre autour! Help.

    Hi, Renee_10,

    Try the solution given by Irfan H in this Thread

    Good luck!

  • I have two portable hard drives with music and video files and cannot get them to play

    I have two portable hard drives with music and movies files can get them to play my laptop girlfriend see them, but does not play

    If you copy the files on the portable hard drive will they play?

  • Fusion iPhone close and wide MacBook movie files

    How to merge small movie files that were recorded with an IPhone with larger files that were recorded using the portable camera? When I merge the parties left and right files wieder in QuickTimePlayer are cut.

    Conversely, when I expand the IPhone more they become blurred and distorted.

    Thank you!

    My preference in this situation is to edit the large clip to the timeline to set the properties of the project for 16:9 automatically.

    Then layer a solid under the clamps portrait - generator by choosing a suitable color for the generator.

    Other duplicate clips of portrait, intensify the lower clamp and apply a blur.

    Yet, others use a plug-in as Karsten Schlüter plugin free.

  • Cut and paste in Windows Explorer is * copy * instead of move.

    In Solution Explorer, if I try to move files and folders using cut and paste (or ctrl-x and then Ctrl + v, or 'cut' and then 'paste' from the Edit menu), they were copied instead of moved. It started just past recently after years of using this technique.

    If I right click, drag and select 'Go here', he moves correctly.

    Any ideas? Very much appreciated.

    See you soon,.
    Michael

    Hello Michael,

    Your computer is connected to a domain?

    This can happen when there is rdpclip.exe service runs as part of a domain network. You can try to stop the rdpclip.exe service to see if that helps.

    Another thing that can help is to make sure that you have installed Windows XP Service Pack 3.

    Hope that helps, I look forward to hearing from you.

    Steven
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • HOW TO MOVE, COPY, AND DOWNLOAD FILES

    How to move a folder?  Unlike XP
    where you can manage files and folders to any location using the navigation bar on the side I can't find how to do this.
    Therefore, I can't copy something on my desk which is located in the document or image folder.
    I can also get the files on drive G which is my on my camera card reader. Using the card because the computer will not read my camera with the cord. Help please - I've been searching help - no success.

    Open Windows Explorer by clicking on computer, then through the directories until you find the folder that you are eager to move (or if you already - as it is on your desktop, simply follow the following procedures).

    Navigate to the folder you want to move and select a simple left click and then type CTRL-C (copy) and CTRL-X (cut).  Then, go to the location where you want the folder (the parent folder), and then type Ctrl + V (paste) and the file will be either be copied or moved (depending on the option you selected).

    This same process will work with your G-drive (just select the files/folders that you want to copy/move and navigate to the destination location and paste them there).

    I hope this helps.

    Good luck! Lorien - a - MCSE/MCSA/network + / A +.

  • Photoshop CS6: image is too large when cut and pasted on a new file window.  I'm cut a picture of 2 x 3 on a new file, and it reads like 8 x 11 or more. How

    Photoshop CS6: I cut and paste a small part (2 x 3 inches) of an image on another new file window (8 x 11).  The transferred image appears huge. If I reduce the size, the whole image and reduced background, not only the image. How can I keep the image of 2 x 3 and keep the size of the canvas of 8 x 11?

    Thank you

    The transferred image appears huge

    Caircraft are 2 x 3 image is higher resolution than your 8 x 11 file.

     
    Change the resolution of the 2 x 3 to match you res 8 x 11 before you copy it to the new file or

    Choose this layer in the copied file and then edit > transform > scale. Be sure to hold the SHIFT key while you move the handles to angle to maintain the proportion.

    If your copied file appears even more of your 8 x 11, see angle of the scale handles, press Cmd + 0 (which is zero) to display the handles

Maybe you are looking for

  • How to anchor bookmarks

    How can I get the menu bookmarks to appear moored along the left margin of the window of firefox?

  • Download page offers a non secure download link

    When I visit the download page and the download starts, I see the file download on simple HTTP connection. This violates security best practices, such as the download can be intercepted and corrupted by a malicious third parties. If I manually change

  • HP ENVY TILT 23-m100-ep: install linux on an HP ENVY TILT 23-m100-ep

    I want to overlap Windows that comes with linux ubuntu computer. A little tutorial would be helpful.

  • Weight 15 t-j100 in 15-j171nr, why 4.8 vs. 5.6 lb

    How can the 15 t-j100 poids.8 lbs less than the 15-j171nr?  Both have the same screen format, of the same battery.  I'm looking for the lightest i7-4700MQ.  I have what would be missing with the j100-15 t which is present in the 15-j171nr?

  • logic with table

    I have a program for my project but I need a logic in logic that I need it is as follows: * If a person enters a number greater than 8 to display "Please enter a number from 1 to 8" * If a person gets into more of a 8 I that it displays "Please only