Re: Moving a random file from the server to workstation

Tech-Archive recommends: Fix windows errors by optimizing your registry



You need to provide more details:
- Do the .pdf files reside on the server or on the workstation?
- Is the script meant to run on the server or on the workstation?
- Do you want to open the files on the server or on the workstation?
- How is the script invoked? By the Task Scheduler? By human action?


"Sylvia" <nospam@xxxxxxxxx> wrote in message
news:ucw5m0qOIHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
This is awesome. The only thing it did not do is open the PDF that it
moved. Anyway of adding that in easily?


"Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
news:OnvOwVqOIHA.6108@xxxxxxxxxxxxxxxxxxxxxxx

"Sylvia" <nospam@xxxxxxxxx> wrote in message
news:uKEzV2pOIHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
I have a shared folder on my server containing a few thousand PDF files.

I would like to set up a script that would move (so no copy remains) one
of the PDF files (it doesn't matter which one, they will all be moved
eventually using this process) from the server to a specific folder on
the local workstation and opens it.

In other words, I want this script to pick a random PDF file (the folder
will only contain PDFs) from a specific shared folder and move it to a
specific folder on the local workstation.

Does anyone have any suggestions on how to do this?

Thanks,
Glenn


You could use this batch file:
#@echo off
#set Source=D:\PDF Folder
#set Target=\\SomeMachine\Some Share\Some Folder
#
#for /F %%a in ('dir "%Source%\*.pdf" ^| find /i "file(s)"') do set
count=%%a
#
#set /a pick = 1 + %random% * count / 32767
#for /F "delims=" %%a in ('dir /b /a-d "%Source%" ^| more +%pick%') do
(set name=%%a& goto Move)
#
#:Move
#echo move "%Source%\%name%" "%Target%"

Please note:
- You must remove the # characters. Their only purpose is to
mark the start of each line.
- Do not retype this program - use copy/paste instead.
- Remove the word "echo" in the last line to activate the batch file.





.



Relevant Pages

  • Re: Changing workstation Admin password through AD
    ... bouncing every member server and workstation monthly is not practical. ... GPO/startup script method... ... Windows Server MVP - Directory Services ... Change the password to the Administrator account ...
    (microsoft.public.win2000.active_directory)
  • Re: Moving a random file from the server to workstation
    ... The script is meant to be run on the workstaiton. ... I want to open the file on the workstation. ... Is the script meant to run on the server or on the workstation? ... folder on the local workstation and opens it. ...
    (microsoft.public.windows.server.scripting)
  • Re: Moving a random file from the server to workstation
    ... The PDFs are being moved from the server to the workstation. ... The script is meant to be run on the workstaiton. ... one of the PDF files (it doesn't matter which one, ...
    (microsoft.public.windows.server.scripting)
  • Re: mapped drives disconnected at boot on workstations
    ... you now map the drives with a logon script. ... The need to enter passwords arises because the server treats ... on the server that is identical to the workstation account+password. ... I have Windows XP workstations and a server running Windows 2000 Server. ...
    (microsoft.public.win2000.networking)
  • Re: mapped drives disconnected at boot on workstations
    ... you now map the drives with a logon script. ... The need to enter passwords arises because the server treats ... on the server that is identical to the workstation account+password. ... I have Windows XP workstations and a server running Windows 2000 Server. ...
    (microsoft.public.win2000.networking)