/build/static/layout/Breadcrumb_cap_w.png

Copy folders , subfolders and files using batch file?

I have a program that will not support a silent install, and it doesn't require running an installation routine in order for it to run successfully.

I have created a post installation task that I hoped would copy the files to their correct locations.
The batch file I created runs perfectly when I execute it locally on the target machine.

I have tried copying the program's directory structure to C:\Program Files\VendorName\ProgramName without success.
(There are several subdirectories, each with their own files and subdirectories as well)

Running it as a post installation task on the K2000, it will only create the first directory.

The batch file (InstallWorkflows.bat) is listed out below:

rem Install Workflows

rem Create Sirsi Directory in C:\Program Files
mkdir "C:\Program Files\Sirsi"

Create SirsiDynix directory in C:\Documents and Settings\All Users\Start Menu\Programs
mkdir "C:\Documents and Settings\All Users\Start Menu\Programs\SirsiDynix"

rem Copy Java Workflows to C:\Program Files\Sirsi
XCOPY Sirsi "C:\Program Files\Sirsi" /s

rem Copy shortcut to the All Users Desktop
copy "WorkFlows 3.4.0J.lnk" "C:\Documents and Settings\All Users\Desktop"

rem Copy shortcut to the Programs directory in All Users Start Menu
copy "WorkFlows 3.4.0J.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\SirsiDynix"

On the K2000, I uploaded a zip file called Workflows.zip, and in the post installation task I created, it executes the batch file "InstallWorkflows.bat."

Does this need to be a VB Script, or can I do this with batch files? If so, what am I missing?

Thanks for any guidance you can provide.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: weberik 12 years ago
Yellow Belt
4
you are looking for xcopy /e
check out the xcopy help:

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string
should be in a separate line in the files. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies the size of each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/G Allows the copying of encrypted files to destination that does
not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
/B Copies the Symbolic Link itself versus the target of the link.
/J Copies using unbuffered I/O. Recommended for very large files.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
Posted by: jgeorge 12 years ago
Senior Purple Belt
0
Thank you Weberik!
That was the missing piece of the puzzle.
Using xcopy with the /s /e switches made it all come together.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ