Was a 4dos user way back in the early 90's and lost contact. Google reacquainted me and I'm back after a long journey....
This is about creating a directory listing to be used as a parse file for a restore script. I have millions of pictures already being backed up, and this is an attempt to create a restore system. The following allows me to repopulate the correct images back onto a workstation (D:) from the server (S:) should the workstation drive fail. Since there are 6 workstations all backing up to the server, I only want certain files restored. Namely files that were already on that workstation when it died. First I need to create the parse file from the workstation.
I need a directory listing (dir /s1 /b) of only the 2nd level directories for a backup application, logging the client files for a restore script that will do an xcopy from this list for restore purposes. Directory Structure is as follows:
Pix2012
Jan
Jan 1 Peter and Betty
Jan 15 Sally's Grad
Feb
Feb 4 Vacation
Feb 16 Dad's Birthday
Mar
Mar 14 Junky Pix
But in my output txt file, I get a separate line for Jan, Feb, and Mar that I don't want. How do I suppress the top level directories and only show the 2nd level and nothing below the 2nd level)
See a snippet of the actual output below (both dir and pdir were tried):
[S:\Pix2012]dir /s1 /b
S:\Pix2012\2012-01 Jan
S:\Pix2012\2012-02 Feb
S:\Pix2012\2012-03 Mar
S:\Pix2012\2012-07 Jul
S:\Pix2012\2012-10 Oct
S:\Pix2012\2012-12 Dec
S:\Pix2012\2012-01 Jan\[2012-01-03] PB Beauti, Marie
S:\Pix2012\2012-02 Feb\[2012-02-03] PB Grass, Paulette
S:\Pix2012\2012-03 Mar\[2012-03-03] PB Himly, Kara
S:\Pix2012\2012-07 Jul\[2012-07-03] PB Petersen, Corleen
S:\Pix2012\2012-10 Oct\[2012-10-05] PB Boyfox, Katey
S:\Pix2012\2012-12 Dec\[2012-12-05] PB Lennox, Sallie
If it just did a full restore by month, it would restore directories that I don't want restored. I only want the 6 listed.
Here is how it will work for a restore. The following will run in a cmd window and restore the directories parsed from the filelist.txt from S: back to D:
for /f "delims=" %%i in (filelist.txt) do echo D|xcopy "s:%%i" "d:%%i" /i /z /y /s
Here is where the idea comes from:
http://www.sidesofmarch.com/index.p...-command-to-copy-files-listed-in-a-text-file/
This is about creating a directory listing to be used as a parse file for a restore script. I have millions of pictures already being backed up, and this is an attempt to create a restore system. The following allows me to repopulate the correct images back onto a workstation (D:) from the server (S:) should the workstation drive fail. Since there are 6 workstations all backing up to the server, I only want certain files restored. Namely files that were already on that workstation when it died. First I need to create the parse file from the workstation.
I need a directory listing (dir /s1 /b) of only the 2nd level directories for a backup application, logging the client files for a restore script that will do an xcopy from this list for restore purposes. Directory Structure is as follows:
Pix2012
Jan
Jan 1 Peter and Betty
Jan 15 Sally's Grad
Feb
Feb 4 Vacation
Feb 16 Dad's Birthday
Mar
Mar 14 Junky Pix
But in my output txt file, I get a separate line for Jan, Feb, and Mar that I don't want. How do I suppress the top level directories and only show the 2nd level and nothing below the 2nd level)
See a snippet of the actual output below (both dir and pdir were tried):
[S:\Pix2012]dir /s1 /b
S:\Pix2012\2012-01 Jan
S:\Pix2012\2012-02 Feb
S:\Pix2012\2012-03 Mar
S:\Pix2012\2012-07 Jul
S:\Pix2012\2012-10 Oct
S:\Pix2012\2012-12 Dec
S:\Pix2012\2012-01 Jan\[2012-01-03] PB Beauti, Marie
S:\Pix2012\2012-02 Feb\[2012-02-03] PB Grass, Paulette
S:\Pix2012\2012-03 Mar\[2012-03-03] PB Himly, Kara
S:\Pix2012\2012-07 Jul\[2012-07-03] PB Petersen, Corleen
S:\Pix2012\2012-10 Oct\[2012-10-05] PB Boyfox, Katey
S:\Pix2012\2012-12 Dec\[2012-12-05] PB Lennox, Sallie
If it just did a full restore by month, it would restore directories that I don't want restored. I only want the 6 listed.
Here is how it will work for a restore. The following will run in a cmd window and restore the directories parsed from the filelist.txt from S: back to D:
for /f "delims=" %%i in (filelist.txt) do echo D|xcopy "s:%%i" "d:%%i" /i /z /y /s
Here is where the idea comes from:
http://www.sidesofmarch.com/index.p...-command-to-copy-files-listed-in-a-text-file/