You are not logged in.

#1 01 Mar 2006 18:04

simondrake79
Member
Registered: 01 Mar 2006
Posts: 5

Copying data and adding shortcuts

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

#2 01 Mar 2006 19:49

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Copying data and adding shortcuts

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

#3 02 Mar 2006 15:23

simondrake79
Member
Registered: 01 Mar 2006
Posts: 5

Re: Copying data and adding shortcuts

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

#4 02 Mar 2006 16:10

simondrake79
Member
Registered: 01 Mar 2006
Posts: 5

Re: Copying data and adding shortcuts

actually i dont need to call it! copy will do

Offline

Board footer

Powered by