years I have been a wonderful library with many ISO ISO images from different manufacturers in both bit depths in several languages? Sure! Who does not? In order still to keep track of course I have directories and subdirectories in a typical structure of an ISO Library looks so like this:
- Microsoft
- Windows
- XP
- Vista
- 7
- EN
- 32
- 64
- DE
- 32
- 64
- Citrix
- XenApp
- 4
- 4.5
- 5
- 6
- 7
- XenDesktop
- XenServer
- Other
What many people do get the CDs from the subdirectories of the library is copied to the root, so does the XenServer ISO. Or directly to somewhere else create a new library for XenServer. Unacceptable. Laaaaaangweilig.
If the existing ISO Library on NTFS based, we still could create hard links - this would show up each ISO file twice (at the original site in a subdirectory and in the root of the share) - to show, however without twice the storage space . Hard links are pointers to a content so only the file system. Will my ISO containing approachable from two sides :-)
I have found in some students pointed out this possibility - always hoping to meet someone, the script enough skills to such a ISOLINK "just" to create. Not applicable. Here in Stuttgart struck me then that I'm using this strategy now for almost a year was not successful - the script I was still missing. realize
Driven by the recently discovered passion, little help, especially for my colleagues CCI (but also for AND customers and basically anyone who has fun on it), I have in the hotel room now made the time.
The script should be run as an admin and used for linking the internal command Win7/Win2008 mklink.exe. A home directory is specified. All ISO files are created under this directory then specify the source directory as a hard link. Here, the folder structure of the ISO file is used, in order to make the file name (less conflict, better readability and assignments).
source and destination path must be on the same partition.
Here is the script, copy & paste ready - just add water:
@ echo off rem # # #
contact daniel.wipperfuerth@adn.de for info / improvements.
echo ######
echo ### script to crawl recursively through your ISO file library
echo ### and linking each found ISO file to a specified directory.
echo ### Pathnames will be used to give the created hardlinks a
echo ### meaningful name - at least if your folders had meaningful names.
echo ### BE SURE YOU UNDERSTAND WHAT THIS SKRIPT IS DOING BEFORE RUNNING IT
echo ######
rem ### Declaring variables - you should customize these
setlocal
rem ### src specifies the starting path - where are all your isos located?
rem ### dst specifies the root of the share that you want XenServer to use
rem ### as ISO Storage Repository (CIFS/NFS).
rem ### bear in mind that src and dst have to be on the same partition.
set src=c:\testlab\_isolinker\lurch
set dst=c:\testlab\_isolinker\share
rem ### SECTION ONE - gathering info
rem ### do the directories exist at all? I will check.
if not exist "%src%" goto :nosrc
if not exist "%dst%" goto :nodst
rem ### main loop - find isos using recursion of dst path
for /F "usebackq delims=/" %%n in (`dir /a:-d /b /s %src%\*.iso`) do call :linkerbell "%%n" %src% %dst%
goto :end
rem ### SECTION TWO - prepare the parameters for the link-command
rem ### process the found isos
:linkerbell
set foundisofile=%1
rem ### filter out the empty line returned by the dir command
if not defined foundisofile goto :EoF
set srcpath=%2
set dstpath=%3
rem ### shorten path, subtract src from found iso path
call set isofile=%%foundisofile:*%srcpath%\=%%
rem ### SECTION THREE - link files like there was no tomorrow
rem ### replace backslashes with underscores for readability
call set isofile2=%isofile:\=_%
mklink /h "%dstpath%\%isofile2% %foundisofile%
goto :EoF
goto: end rem
# # # different endings to our wonderful story
: nosrc
echo Your so called source directory has been stolen - get a new one.
echo The directory i did not find was:% src%
goto: end
: nodst
echo The destination directory smells like teen spirit - get a new one.
echo The directory i did not find was: dst
%% goto: end rem # # #
cleaning up
: end
endlocal
pause
0 comments:
Post a Comment