Re: Moving a random file from the server to workstation
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Sun, 9 Dec 2007 21:52:38 +0100
"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
- Moving a random file from the server to workstation
- Prev by Date: 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: 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
|