1. TechSpot is dedicated to computer enthusiasts and power users. Ask a question and give support. Join the community here.
    TechSpot is dedicated to computer enthusiasts and power users.
    Ask a question and give support.
    Join the community here, it only takes a minute.
    Dismiss Notice

Problems with XCOPY over networked drive

By wolfpacker101 ยท 8 replies
Mar 31, 2004
  1. My computer is setup as an FTP server so I can access files from campus. Right now I am working on a senior design project were we have a dedicated computer in a lab to do our work, but I want to syncronize the information on the two computers so the group members can access our files by logging onto my ftp server.

    I have written this batch file to perform the synchronization every night. The transfer from the ftp server (mapped as drive Z:\) works great, but when I try to upload from the lab computer (C:\) to the ftp server (Z:\) I get the error that a directory cannot be created.

    The "Backpack Alarm" Folder has a few files located in it, and several folders I also want to sync (hence the /s argument).

    REM Sets up the Z:\ drive to the FTP site and syncronizes
    REM the 'C:\Backpack Alarm' folder on the computer in troxler
    REM and the information on the FTP site.
    REM - This code may only be ran on the computer in Troxler.
    REM - The only files examined are the ones in which the ARCHIVE bit is set
    REM - It uses the account 'XXXXXXX' to log into system.
    REM - This Drive Mapping will be removed after logging out.

    echo off
    echo Connecting drive
    echo This may take several seconds....
    net use z: \\FTPSERVERNAMEHERE\SeniorDesign /user:XXXXXXX ****** /Persistent:NO
    echo Connection completed
    echo ======================================
    echo Transferring new files...
    echo Troxler -to- FTP
    echo ---------------------
    xcopy ".\*.*" z:\ /a/d/s/y
    REM The previous line does not work
    echo PLEASE WAIT....
    echo ---------------------
    echo FTP updated with new files
    echo Transferring new files...
    echo FTP -to- Troxler
    echo ---------------------
    REM Switch to Z: directory
    xcopy .\*.* "C:\Backpack Alarm" /a/d/s/y
    echo ---------------------
    echo Troxler updated with new files
    echo ==============================================
    echo Transfer complete
    echo The Files on the FTP and Troxler computer are now synchronized
    echo on


    Everything works correctly except the "xcopy ".\*.*" z:\ /a/d/s/y" command; it returns an error that the director cannot be created. (The account does have Read/Write permission and the command does copy the files located directly in C:\Backpack Alarm. It just freaks out when it starts to go into the subdirectories.

    Does anybody have any suggestions on what I can do. or what may be causing the error? Some of the subfolders go pretty deep and I don't want to have to go through them recursively and copy all the files from each folder individually.

    Any help would be much appreciated.
  2. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

    Try and take out the " quote-marks in that line, similar to the one further down

    By the way, Welcome to TechSpot"
  3. wolfpacker101

    wolfpacker101 TS Rookie Topic Starter

    I took out the quotes, but it is still not working. (They had been left in after I had tried something else that needed them).

    Here is the error that I am getting when that command runs:

    Transferring new files...
    Troxler -- FTP
    File creation error - The directory is not empty.

    Unable to create directory - Z:\E-mail Archive
    1 File(s) copied

    The rest runs fine.

    Any suggestions on what the problem might be?
  4. Liquidlen

    Liquidlen TechSpot Paladin Posts: 1,094

    My command line is very rusty but I will give this a shot ,Forgive me if I miss a mile.
    Everything works correctly except the "xcopy ".\*.*" z:\ /a/d/s/y"
    Dosen't " .\ " mean the root drive if so " *.* " is telling Xcopy to copy all files in the root drive" C:\ " to Z:\
    But you are presently operating in cmd.exe which on the present C:\ drive and therefore can't be copied since files are presently in use.
    I think you have to specify the C:\ Backpack Alarm directory only.
    I could be wrong though.
  5. wolfpacker101

    wolfpacker101 TS Rookie Topic Starter

    It has been my understanding that the "." represents the current directory and ".." represents the parent directory. For example, if you are in a folder, and you type "cd ." you remain in the same directory that you are already in, and if you type "cd .." you move up to the parent.

    I did try you suggestion though and had no luck.

    I also tried specifying the directory WRT the root directory. (This was where the quotes were left from in my previous code).

    C:\Backpack Alarm>xcopy "C:\Backpack Alarm\*.*" z:\ /a/d/s/y
    C:\Backpack Alarm\SyncFTP.bat
    File creation error - The directory is not empty.

    Unable to create directory - Z:\E-mail Archive
    1 File(s) copied

    I tried this command directly at the command prompt rather than in the batch file, but this is the error that I got. One reason that it really baffles me is because the "E-mail Archive" directory is already created in the Z:\ drive, so it shouldn't be trying to create it anyways. And I know that the problem cannot be because the Z drive is a mapped FTP server; the "SyncFTP.bat" file is sucessfully transferred.

    I don't know if it might help any, but here is the directory listing for the Z drive:

    Volume in drive Z has no label.
    Volume Serial Number is 0000-0000

    Directory of Z:\

    03/26/2004 04:58 PM <DIR> .
    03/26/2004 04:58 PM <DIR> ..
    03/24/2004 10:46 PM <DIR> E-mail Archive
    03/04/2004 06:03 PM <DIR> Graphics
    03/16/2004 06:35 PM <DIR> Hardware
    02/17/2004 11:48 PM 325 mapFTP.bat
    03/31/2004 12:41 AM <DIR> Meetings
    02/25/2004 05:18 PM <DIR> Reports
    03/29/2004 03:06 PM <DIR> Software
    04/01/2004 02:11 PM 1,234 SyncFTP.bat
    2 File(s) 1,559 bytes
    8 Dir(s) 5,915,336,704 bytes free

    (The "mapFTP.bat" file has had the 'archive' attribute removed, therefore it isn't suppose to transfer).

    Anybody else have a suggestion? I appreciate any and all.
  6. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

    You need to enter the following 2 bold lines in FTPsync.bat and change the xcopy line as follows

    echo Troxler -to- FTP
    echo ---------------------
    CD \Backpack Alarm

    XCOPY *.* z:\ /a/d/s/y
  7. Nodsu

    Nodsu TS Rookie Posts: 5,837   +6

    I don't think that will help because in his last post wolfpacker demonstrated that it doesn't work even with absolute paths.

    One could try adding /R to xcopy options and do replace /S with /E. Why are you not putting spaces between command line switches? Also triple check if you have full control permissions to all the folders and subfolders and files on that network drive. You need all read, write and replace permissions.
  8. wolfpacker101

    wolfpacker101 TS Rookie Topic Starter

    That doesn't work. I'm running the batch file from the "Backpack Alarm" directory already, so those commands simply put it right back to where it is.

    I also tried adding the "/R" and "/E" arguments and that did not work either. I guess the reason for me not having spaces between the arguments is simply bad syntax on my part. All my command line knowledge is self-taught, so I'll be sure to adjust my coding in the future.

    I did try something else as a simple test:

    C:\Backpack Alarm\E-mail Archive>xcopy *.* "z:\E-mail Archive" /a /d /e /y /r
    C:New Test File.txt
    File creation error - Logon failure: unknown user name or bad password.

    I moved to the E-mail Archive directory and tried the command from there. This command was run after establishing the z drive through the same "net use z: \\...." as in the first posting. The username and password are both correct and I checked the permissions on the FTP again and I had it set to "Full Control."

    Is there another way that I can point it to go to the FTP server rather than setting it up as a network drive and still automate the process in a batch file? I can open the FTP server in IE and transfer files manually without any problems. I have noticed though in the past that if I setup the drive in "My Computer", after transferring a file or two, I will get a similar error message about the username and password and must disconnect and reconnect to get it working again. When connected through IE, I never have this problem.
  9. RealBlackStuff

    RealBlackStuff TS Rookie Posts: 6,503

Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...