You are not logged in.
Pages: 1
Hi
I've got a project to get rid of old data on one of our file servers at work. I could just use ROBOCOPY to move the data across but i would like to add shortcuts so as not to hinder the usage for our employees. i.e. make the change transparent
I have got hold of a VB script from WindowsITPro called edir.vbs and this searches and dumps the full path to whatever search criteria i define into a text file. It looks something like this:
C:\Scripts\EDIR\old_data\ADD.TXT
C:\Scripts\EDIR\old_data\ATC.QB4
C:\Scripts\EDIR\old_data\ATC60.TXT
C:\Scripts\EDIR\old_data\ATC63.TXT
C:\Scripts\EDIR\old_data\BEN.BAT
C:\Scripts\EDIR\old_data\BISH.TXT
Now all i need to do is go through this line by line and copy the file then create a shortcut. Something like this:
FOR /F "tokens=*" %%G IN (xxx.txt) DO
this is where i get stuck. How do i tell it to copy the file and THEN create the shortcut. Also, the shortcut.exe util needs a different path to the copied location i.e.
old file = c:\old_data\xxx.txt
new file = \\data-server\old_data\xxx.txt
how do i get the code to manipulate the path to read the correct path
if anyone has done this before then some pointers would be appreciated. I'm not a developer or coding type of person so this doesnt come easy to me.
Thanks
Simon
Offline
you need something like
FOR /F "tokens=*" %%G IN (xxx.txt) DO call :my_subroutine "%%G"
goto :eof
:my_subroutine
echo "%1" is the filename
copy %1 ...
shortcut ...
goto :eof
For splitting up the filename and path look at this page
http://ss64.com/nt/syntax-args.html
Offline
cheers Simon
Can i call ROBOCOPY from within my subroutine as long as the ROBOCOPY.exe is in the same folder as the script?
Offline
actually i dont need to call it! copy will do
Offline
Pages: 1