Bactch script to copy every filese and subFolder to the specific distination

Recently, I have working on the Android project we work with git (bitbucket). The problems is the git repository contain the Eclipse configuration but I prefer to use Android Studio (IntelliJ) to work. So It's quite hard to commit the project built from IntelliJ which has different folder structure from Eclipse.

The solution is using the script that will move every files and subFolder from IntelliJ project to eclipse project. Then run this script every time I run the project. After a searched here is the results.

robocopy D:\androidWorkspace\AndroidIntelliJ\secretProject\src\main\java\com\umitems\mtd D:\androidWorkspace\EclipseSecretProject\src\com\umitems\mtd /E

robocopy D:\androidWorkspace\AndroidIntelliJ\secretProject\src\main\res D:\androidWorkspace\EclipseSecretProject\res /E

copy D:\androidWorkspace\AndroidIntelliJ\secretProject\src\main\AndroidManifest.xml D:\androidWorkspace\EclipseSecretProject\AndroidManifest.xml /Y

I save this code in file moveFiles2Eclipse.bat and call this file as an exerternal tool when I run the project in AndroidStudio.


copy probably copy single specific file

COPY [/Y|-Y] [/A][/B] [d:][path]filename [/A][/B] [d:][path][filename] [/V]

/Y - Causes COPY to replace existing files.

robocopy will copy copy every filese and subFolder to the specific distination

ROBOCOPY <source> <destination> [file…] [options]

Copies subdirectories. Note that this option excludes empty directories.
Copies subdirectories. Note that this option includes empty directories. For additional information, see Remarks.
Copies only the top N levels of the source directory tree.
Copies files in Restart mode.
Copies files in Backup mode.
Uses Restart mode. If access is denied, this option uses Backup mode.
Copies all encrypted files in EFS RAW mode.
Specifies the file properties to be copied. The following are the valid values for this option:
D Data
A Attributes
T Time stamps
S NTFS access control list (ACL)
O Owner information
U Auditing information
The default value for CopyFlags is DAT (data, attributes, and time stamps).
Copies directory time stamps.
Copies files with security (equivalent to /copy:DAT).
Copies all file information (equivalent to /copy:DATSOU).
Copies no file information (useful with /purge).
Fixes file security on all files, even skipped ones.
Fixes file times on all files, even skipped ones.
Deletes destination files and directories that no longer exist in the source. For additional information, see Remarks.
Mirrors a directory tree (equivalent to /e plus /purge). For additional information, see Remarks.
Moves files, and deletes them from the source after they are copied.
Moves files and directories, and deletes them from the source after they are copied.
Adds the specified attributes to copied files.
Removes the specified attributes from copied files.
Creates a directory tree and zero-length files only.
Creates destination files by using 8.3 character-length FAT file names only.
Turns off support for very long paths (longer than 256 characters).
Monitors the source, and runs again when more than N changes are detected.
Monitors source, and runs again in M minutes if changes are detected.
Creates multi-threaded copies with N threads. N must be an integer between 1 and 128. The default value for N is 8.
The /MT parameter cannot be used with the /IPG and /EFSRAW parameters.
Redirect output using /LOG option for better performance.
The /MT parameter applies to Windows Server 2008 R2 and Windows 7.
Specifies run times when new copies may be started.
Checks run times on a per-file (not per-pass) basis.
Specifies the inter-packet gap to free bandwidth on slow lines.
Copies the symbolic link instead of the target.

More option for copy

/-Y - Displays a confirmation prompt before copying over existing files.

/A - Used to copy ASCII files. Applies to the filename preceding it and to all following filenames. Files will be copied until an end-of-file mark is encountered in the file being copied. If an end-of-file mark is encountered in the file, the rest of the file is not copied. DOS will append an end-of-file mark at the end of the copied file.

/B - Used to copy binary files. Applies to the filename preceding it and to all following filenames. Copied files will be read by size (according to the number of bytes indicated in the file`s directory listing). An end-of-file mark is not placed at the end of the copied file.

/V - Checks after the copy to assure that a file was copied correctly. If the copy cannot be verified, the program will display an error message. Using this option will result in a slower copying process.

the command xcopy can do the task like this but it is too old.
Better use robocopy its mus faster and you have lot of swithches as well.


Popular posts from this blog

เทคนิค ชนะ เกมเศรษฐี 14 ตารวด!!! ( Let's get Rich )

Using Google Chrome Inspect Element to Analyze the website

Easy way to download whole youtube play list and convert them to mp3