Re: Moving a random file from the server to workstation
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Sun, 9 Dec 2007 23:10:52 +0100
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.
.
- Follow-Ups:
- References:
- Moving a random file from the server to workstation
- From: Sylvia
- Re: Moving a random file from the server to workstation
- From: Pegasus \(MVP\)
- Re: Moving a random file from the server to workstation
- From: Sylvia
- Moving a random file from the server to workstation
- Prev by Date: Re: Moving a random file from the server to workstation
- Next by Date: Re: Moving a random file from the server to workstation
- Previous by thread: Re: Moving a random file from the server to workstation
- Next by thread: Re: Moving a random file from the server to workstation
- Index(es):
Relevant Pages
|