Sign in to follow this  
Followers 0
cyanidemonkey

copy folders/files over a network?

7 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

well if the networks allow the files/folders to be edited

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

By the way, this is not, apparently, true for local drives - only network drives. Also, I'm using a Netware drive mapping, if that matters.


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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0