Directory Name Ends Up Hidden After Network Copy

quick2steve

New Member
I have two batch scripts (Script 1 & Script 2). A directory name is being hidden under both scripts when I view it through explorer. Depending on how I write the script different level is being hidden. I am not sure if the problem is caused by the mapping or by the robocopy command. Can anyone please help?

Script 1 - The destination directory (2009-03-18) right under the mapped drive ends up hidden
@ECHO OFF
set d=R:
rem
rem map network drive
net use %d% /d /y
rem
rem map network drive
net use %d% "\\RND4250\Steve_Backups\Daily"
rem
rem generate directory name
set h=%time:~0,2%
IF %time:~0,2% LSS 10 (set h=0%time:~1,1%)
set m=%time:~3,2%
set dirname=%date:~10,4%-%date:~4,2%-%date:~7,2%
rem
rem create directory
%d%
IF EXIST %dirname% (Set dirname=%dirname%-%h%%m%)
mkdir %dirname%
rem
rem generate robocopy command
set from=C:\Users\Steve\Documents
set to=%d%\%dirname%
robocopy "%from%" "%to%" /E /COPY:DAT /R:10 /Z /XJ /log:%d%\RoboCopyLog.txt
rem
rem unmap network drive
net use %d% /d /y
exit

Script 2 - The destination directory (Documents) right under 2009-03-18 ends up being hidden
@ECHO OFF
set d=R:
rem
rem map network drive
net use %d% /d /y
rem
rem map network drive
net use %d% "\\RND4250\Steve_Backups"
rem
rem generate directory name
set h=%time:~0,2%
IF %time:~0,2% LSS 10 (set h=0%time:~1,1%)
set m=%time:~3,2%
set dirname=%date:~10,4%-%date:~4,2%-%date:~7,2%
rem
rem create directory
%d%
cd Daily
IF EXIST %dirname% (Set dirname=%dirname%-%h%%m%)
mkdir %dirname%
rem
rem generate robocopy command
set from=C:\Users\Steve\Documents
set to=%d%\Daily\%dirname%
robocopy "%from%" "%to%" /E /COPY:DAT /R:10 /Z /XJ /log:%d%\RoboCopyLog.txt
rem
rem unmap network drive
net use %d% /d /y
exit
 

My Computer

Back
Top