Solved

Software to move folders

Posted on 2008-06-10
6
193 Views
Last Modified: 2010-04-21
I am looking for some type of software that I can use to schedule an automatic move of files from one MS server to another MS server.  Does anybody know of any software like that?  Thanks for your help!
0
Comment
Question by:hjmission
  • 3
  • 3
6 Comments
 
LVL 32

Expert Comment

by:r-k
Comment Utility
Assuming the files are not "in use" at that time, you should be able to do this by just putting a couple of commands in a batch file and scheduling it to run at time you want.

Namely:

  xcopy to copy the folder and its subfolders.
  del to delete the folders that have been copied.

You will want to put in some logic to not do "del" if any of the xcopy failed. And carefully test something like this to avoid losing files.
0
 
LVL 1

Author Comment

by:hjmission
Comment Utility
r-k    will that move a complete folder?  Can you use a wildcard with that?
0
 
LVL 32

Accepted Solution

by:
r-k earned 500 total points
Comment Utility
Yes, you can move entire folders and sub-fodlers within, with the xcopy command. For example:

 xcopy J:\myfolder\*.* /s/e K:\myfolder\ /c/f/h/d/y

will move everything in \myfolder\ on the J: drive to a corresponding folder on the K: drive, including all sub-folders below \myfolder\

The switches I used above are:

Rem       /s  means all subdirectories also
Rem       /e  means empty folders also
Rem       /c  means ignore errors
Rem       /f  means full display in console window
Rem       /h  means hidden files also copied
Rem       /d  means copy only those files that have changed
Rem       /y  means do not prompt for overwriting existing files

Type "xcopy /?" at a command prompt to see other options.

In your case you may want to leave out the /c switch so you don't ignore errors. Another useful option is /exclude where you can have a list of files withing those folders you don't want want copied.

Be sure not to run the "del" command if the xcopy encounters any error (network down e.g.).

There is a limitation of the xcopy command that you should be aware of. It cannot copy files with the path or name longer than a certain length (128 or 256, I forget which). You can check if this applies in your case by running a test run of xcopy on the folders of interest.

0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Author Comment

by:hjmission
Comment Utility
r-k      this looks like what i am wanting.  Can I run this command with something like Task Scheduler so I can get it done everyday?
0
 
LVL 32

Expert Comment

by:r-k
Comment Utility
Yes, you can put all your commands in a file named "something.bat", then schedule it with the task scheduler like any other program.

Testing and error checking are important, of course.

I have to run but I'll post some tips later on how you can save a log of what gets copied, and an error log.

You can also include a command to map a network drive in the same command/batch file.
0
 
LVL 1

Author Closing Comment

by:hjmission
Comment Utility
r-k  thanks for all of your help.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now