Jump to content

copy folders/files over a network?


Recommended Posts

Hi,

My boss wants me to automate setting up a project folder and placing templates into it.

I figure this would be done via the File & Directory Functions.

I'm wondering if it can be done over a network, i.e project manager can have a autoit exe on their work station that will copy folders and template files on our file server.

Can this be done?

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

  • 2 weeks later...

I've actually just completed a similar project with the same problem. Everything works fine if you use a local drive letter (using DirCreate()), but if you use a network drive letter, it dies.

“Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker

Link to comment
Share on other sites

Ok, I've figured it out. FileCreate will only create subfolders if the containing folder already exists.

So, if you want to create j:\test\new\folder\creation, you have to do the following:

DirCreate("J:\Test")
DirCreate("J:\Test\new")
DirCreate("J:\Test\new\folder")
DirCreate("J:\Test\new\folder\creation")

Or, you could create a simple parsing loop that would parse the path and loop through creating each folder until it gets to the last folder.

I find it's easier to create a template folder structure and use a simiple DIR command in DOS to get the structure. Then I use a text editor (such as Textpad) to replace sections of the path with variables.

The DOS command I use for this is:

"Dir /ad/s/b"

This will return a list of all subdirectories of the current dir in simple format. It won't display any filenames.

Does anyone know if AutoIT has an easier way of creating semi-complicated deep directory structures without creating each and every common parent directory?

“Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker

Link to comment
Share on other sites

I use a combination of two Console Commands to copy 2 - 3 TB of data every week to backup servers.

NET Use and XCopy.

Net Use Y: \\ss03cluster\ssW03Backup ;temporarily maps folder on cluster to Y:\Drive

XCopy D: Y: /E /H /Y ;Copies everything from D:\Drive to Y:\Drive

These commands respond well to scripting too. I prefer the XCopy command due to the ability to copy and overwrite hidden and read-only files; recreates folder construct including empty ones and that the copy is and exact (verified) copy.

Link to comment
Share on other sites

Which would work, except for the majority of what I'm doing, I need to create dynamic folder names with no content based on input from the user.

So, there's a basic template folder structure that is followed to create the structure, but in the end there are several dynamically named folders stuck in the middle. Creating whole paths on the hard drive works fine, but when I try it on the server drive (which is already mapped, btw), it fails to create any path names that contain multiple levels.

“Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...