Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Batch file makes hidden folders? (Pro)

    I wrote the following batch file to backup K: Drive.

    xcopy.exe "K:" "I:BackupsDrive K" /s /y /d

    I ran the batch file and at first I thought it had failed. However when I unchecked "Hide protected operating system files" under Folder options Explorer reveals the folder is there only hidden. I checked the properties of the backup folder and not only is the hidden attributes checked, it's also greyed out so I can't change it. Why is this? Incidentally I found that if I didn't type .exe and only typed xcopy the batch file failed. Is something wonky?

    Thanks,

    Chris (Hunt)

  2. #2
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Batch file makes hidden folders? (Pro)

    Something looks funny about that command line, Chris. Shouldn't it be: <big>xcopy.exe "K:" " I:BackupsK:" /s /y /d</big>

    I've never done it (yet) in XP, but I wonder if the <big>/K</big> or <big>/A</big> parms might help?

  3. #3
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file makes hidden folders? (Pro)

    Hi Big Al. I tired the command line you gave and it didn't work! Can you elaborate on what's strange about the one I gave? 'Drive K' is the name of the folder I'm copying the files to. Incidentally I noticed something that I think is strange. In explorer the file shows as normal in the left pane. It's only faint in the right pane. If I change the settings in file options to hide protected operating system files the folder is completely hidden in the right pane of explorer but still clearly visible in the left. Is that normal? It seems very odd to me.

    If I use the command line I gave to copy a folder on K drive as opposed to the root it copies the folder without problem - nothing is hidden.

    I really can't put my finger on what's up but I seem to be having lots of little niggles. I'm wondering if I could have messed up the installation in some way?

    Chris

  4. #4
    Plutonium Lounger
    Join Date
    Oct 2001
    Location
    Lexington, Kentucky, USA
    Posts
    12,107
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Batch file makes hidden folders? (Pro)

    Sorry 'bout that, Chris. Disregard that last, I thought maybe you had a typo for a drive, rather than a folder. However, in that case don't you need quotes around the "drive k" part? I dunno either, but I'll keep thinking about it whilst I go off to work.

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file makes hidden folders? (Pro)

    Chris, you didn't tell XCOPY what to copy. Your example:
    <pre>xcopy.exe "K:" "I:BackupsDrive K" /s /y /d</pre>

    should have a filespec - meaning the kinds of files that it's searching for - to copy. Thus,
    <pre>xcopy "K:*.*" "I:BackupsDrive K" /s /y /d</pre>

    Strictly speaking, the quotes are not needed unless you are using long filenames in the arguments, so you could remove them from the first one and leave it simply K:*.*.

    When debugging a batch file, execute the commands manually at the command line, so you can see what is happening, or pipe the output to a text file. You can do that like so:<pre>xcopy "K:*.*" "I:BackupsDrive K" /s /y /d > L:xcopy.out</pre>

    This will create a file named XCOPY.OUT on the L: drive that contains what you would normally have seen on the screen. It will be overwritten each time the batch is run.

    HTH,
    -Mark

  6. #6
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Hatsukaichi, Hiroshima, Japan
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file makes hidden folders? (Pro)

    Great, Mark - that did the job! At first I thought your command wasn't working either with K: *.* in quotes or without but once I removed the instruction to make a log it worked and gave me a folder that wasn't hidden. It seemed to take longer copying, though. Is the behaviour I described for hidden files and folders in my last post normal?

    Thanks,

    Chris

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch file makes hidden folders? (Pro)

    Normally, XCOPY will reset attributes. To make it copy those as well, you must append the /K switch. So yes, it appears to be normal behavior, from what I've read. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    -Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •